/* =============================================================================
   baileys_esam · Capa de diseño (Seguimiento ESAM)
   Refina la plantilla Velzon conservando la identidad institucional:
   azul marino profundo + azul marca ESAM + señal amarilla.
   ============================================================================= */

/* --- Tipografía: Inter Variable auto-hospedada ------------------------------ */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* =============================================================================
   Tokens
   ============================================================================= */
:root {
  /* Marca institucional ESAM */
  --navy-950: #03101f;
  --navy-900: #061f3b;
  --navy-800: #0a2c4f;
  --navy-700: #0e3a66;
  --brand: #045474;
  --brand-600: #036084;
  --brand-500: #0a6a90;
  --brand-400: #2e90b5;
  --brand-300: #79bfda;
  --signal: #e6dd5e;
  --signal-strong: #f0e88a;

  /* Neutros fríos */
  --esam-canvas: #f2f5f9;
  --esam-surface: #ffffff;
  --esam-surface-2: #f7f9fc;
  --esam-surface-3: #edf1f7;
  --esam-ink: #0e1a2b;
  --esam-ink-soft: #3b4a5e;
  --esam-muted: #66768b;
  --esam-line: #e3e8f1;
  --esam-line-strong: #d3dbe8;

  /* Semánticos */
  --esam-success: #0f7a52;
  --esam-success-bright: #12996a;
  --esam-info: #2b6cb0;
  --esam-warning: #b45309;
  --esam-danger: #bb3b3b;

  /* Radios */
  --esam-radius: 14px;
  --esam-radius-lg: 18px;
  --esam-radius-sm: 10px;
  --esam-radius-xs: 8px;

  /* Elevación: la sombra se reserva para superficies flotantes o interactivas */
  --esam-shadow-xs: 0 1px 2px rgba(14, 26, 43, 0.05);
  --esam-shadow-sm: 0 2px 6px -2px rgba(14, 26, 43, 0.08), 0 1px 2px rgba(14, 26, 43, 0.04);
  --esam-shadow: 0 12px 28px -14px rgba(14, 26, 43, 0.24), 0 2px 6px -2px rgba(14, 26, 43, 0.08);
  --esam-shadow-lg: 0 24px 48px -20px rgba(14, 26, 43, 0.3);
  --esam-ring: 0 0 0 3px rgba(4, 84, 116, 0.16);
  --esam-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --esam-ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Ritmo espacial */
  --esam-gap-1: 0.25rem;
  --esam-gap-2: 0.5rem;
  --esam-gap-3: 0.75rem;
  --esam-gap-4: 1rem;
  --esam-gap-5: 1.5rem;
  --esam-gap-6: 2rem;
}

html[data-bs-theme="dark"] {
  --esam-canvas: #0a1220;
  --esam-surface: #111b2a;
  --esam-surface-2: #16202f;
  --esam-surface-3: #1c283a;
  --esam-ink: #f1f5fb;
  --esam-ink-soft: #c3cedd;
  --esam-muted: #8b9cb3;
  --esam-line: #223148;
  --esam-line-strong: #2c3d57;
  --esam-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --esam-shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.45);
  --esam-shadow: 0 16px 36px -16px rgba(0, 0, 0, 0.7);
  --esam-shadow-lg: 0 28px 56px -22px rgba(0, 0, 0, 0.75);
}

/* --- Overrides de las variables de Velzon ---------------------------------- */
:root,
[data-theme="default"] {
  --vz-font-family-primary: "Inter Variable", "Inter", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --vz-font-family-secondary: var(--vz-font-family-primary);
  --vz-headings-font-family: var(--vz-font-family-primary);
  --vz-headings-font-weight: 600;
  --vz-font-base: 0.875rem;
  --vz-font-13: 0.8125rem;

  --vz-primary: #045474;
  --vz-primary-rgb: 4, 84, 116;
  --vz-success: #0f7a52;
  --vz-success-rgb: 15, 122, 82;
  --vz-info: #2b6cb0;
  --vz-info-rgb: 43, 108, 176;
  --vz-warning: #b45309;
  --vz-warning-rgb: 180, 83, 9;
  --vz-danger: #bb3b3b;
  --vz-danger-rgb: 187, 59, 59;
  --vz-link-color: #045474;
  --vz-link-hover-color: #0a6a90;

  --vz-body-bg: var(--esam-canvas);
  --vz-body-color: var(--esam-ink-soft);
  --vz-emphasis-color: var(--esam-ink);
  --vz-heading-color: var(--esam-ink);
  --vz-secondary-color: var(--esam-muted);
  --vz-border-color: var(--esam-line);
  --vz-border-color-translucent: var(--esam-line);
  --vz-light: var(--esam-surface-2);
  --vz-light-rgb: 247, 249, 252;

  --vz-card-bg: var(--esam-surface);
  --vz-card-border-color: var(--esam-line);
  --vz-card-border-width-custom: 1px;
  --vz-card-shadow: none;
  --vz-card-cap-bg: transparent;

  --vz-border-radius: 14px;
  --vz-border-radius-sm: 10px;
  --vz-border-radius-lg: 18px;
  --vz-box-shadow-sm: var(--esam-shadow-sm);
}

html[data-bs-theme="dark"] {
  --vz-body-bg: var(--esam-canvas);
  --vz-body-color: var(--esam-ink-soft);
  --vz-heading-color: var(--esam-ink);
  --vz-secondary-color: var(--esam-muted);
  --vz-border-color: var(--esam-line);
  --vz-card-bg: var(--esam-surface);
  --vz-card-border-color: var(--esam-line);
  --vz-light: var(--esam-surface-2);
}

/* =============================================================================
   Base · superficies del navegador
   ============================================================================= */
body {
  font-family: var(--vz-font-family-primary);
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--esam-ink-soft);
  background-color: var(--esam-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { text-underline-offset: 2px; }

::selection {
  background: rgba(4, 84, 116, 0.2);
  color: var(--esam-ink);
}

:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
  border-radius: 4px;
}

textarea {
  caret-color: var(--brand);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--esam-line-strong) transparent;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--esam-line-strong);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--esam-muted);
  background-clip: content-box;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--esam-ink);
  font-family: var(--vz-font-family-primary);
  font-weight: 650;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

b, strong { font-weight: 600; }

/* Números alineados en datos y métricas */
.tabular-nums,
.stat-value,
.table td,
.table th,
.ff-monospace {
  font-variant-numeric: tabular-nums;
}

.text-muted { color: var(--esam-muted) !important; }

/* =============================================================================
   Botones
   ============================================================================= */
.btn {
  --vz-btn-font-weight: 600;
  --vz-btn-focus-box-shadow: var(--esam-ring);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border-radius: var(--esam-radius-sm);
  letter-spacing: 0.005em;
  padding: 0.5rem 0.9rem;
  transition: background-color 0.18s var(--esam-ease),
    border-color 0.18s var(--esam-ease), color 0.18s var(--esam-ease),
    box-shadow 0.18s var(--esam-ease), transform 0.12s var(--esam-ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn.disabled { opacity: 0.55; box-shadow: none; transform: none; }
.btn > i { line-height: 1; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; border-radius: 8px; }
.btn-lg { padding: 0.65rem 1.15rem; font-size: 0.95rem; }

.btn-primary {
  --vz-btn-bg: var(--brand);
  --vz-btn-border-color: var(--brand);
  --vz-btn-hover-bg: var(--brand-500);
  --vz-btn-hover-border-color: var(--brand-500);
  --vz-btn-active-bg: var(--brand-600);
  --vz-btn-active-border-color: var(--brand-600);
  --vz-btn-disabled-bg: var(--brand);
  --vz-btn-disabled-border-color: var(--brand);
  box-shadow: 0 1px 2px rgba(4, 84, 116, 0.24);
}
.btn-success {
  --vz-btn-bg: var(--brand);
  --vz-btn-border-color: var(--brand);
  --vz-btn-hover-bg: var(--brand-500);
  --vz-btn-hover-border-color: var(--brand-500);
  --vz-btn-active-bg: var(--brand-600);
  --vz-btn-active-border-color: var(--brand-600);
  box-shadow: 0 1px 2px rgba(4, 84, 116, 0.24);
}

.btn-soft-primary {
  background: rgba(4, 84, 116, 0.1);
  border-color: transparent;
  color: var(--brand);
}
.btn-soft-primary:hover,
.btn-soft-primary:focus {
  background: rgba(4, 84, 116, 0.16);
  color: var(--brand-600);
}
.btn-soft-secondary {
  background: var(--esam-surface-3);
  border-color: transparent;
  color: var(--esam-ink-soft);
}
.btn-soft-secondary:hover,
.btn-soft-secondary:focus {
  background: var(--esam-line);
  color: var(--esam-ink);
}
.btn-soft-danger { background: rgba(187, 59, 59, 0.1); color: var(--esam-danger); border-color: transparent; }
.btn-soft-danger:hover { background: rgba(187, 59, 59, 0.18); color: var(--esam-danger); }
.btn-soft-warning { background: rgba(180, 83, 9, 0.1); color: var(--esam-warning); border-color: transparent; }
.btn-soft-warning:hover { background: rgba(180, 83, 9, 0.18); color: var(--esam-warning); }
.btn-soft-success { background: rgba(15, 122, 82, 0.1); color: var(--esam-success); border-color: transparent; }
.btn-soft-success:hover { background: rgba(15, 122, 82, 0.18); color: var(--esam-success); }

.btn-link { font-weight: 600; text-decoration: none; }

/* Botón señal de marca (acción destacada puntual) */
.btn-brand-signal {
  background: var(--signal);
  border-color: var(--signal);
  color: var(--navy-900);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(180, 160, 20, 0.3);
}
.btn-brand-signal:hover {
  background: var(--signal-strong);
  border-color: var(--signal-strong);
  color: var(--navy-950);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
}
.btn-icon.btn-sm { width: 1.9rem; height: 1.9rem; }
.btn-icon i { line-height: 1; }

/* =============================================================================
   Tarjetas
   ============================================================================= */
.card {
  background-color: var(--esam-surface);
  border: 1px solid var(--esam-line);
  border-radius: var(--esam-radius);
  box-shadow: none;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--esam-line);
  padding: 1rem 1.25rem;
}
.card-header:first-child { border-radius: var(--esam-radius) var(--esam-radius) 0 0; }
.card-footer {
  background: transparent;
  border-top: 1px solid var(--esam-line);
  padding: 0.9rem 1.25rem;
}
.card-body { padding: 1.25rem; }
.card-title { color: var(--esam-ink); font-weight: 650; font-size: 0.95rem; margin-bottom: 0; }
.card-title + .text-muted { margin-top: 0.2rem; }
.card-height-100 { height: calc(100% - var(--vz-grid-gutter-width)); }
/* Las tarjetas con interacción elevan su sombra al pasar el cursor. */
.card-hover,
.card[data-batch] {
  transition: box-shadow 0.2s var(--esam-ease), transform 0.2s var(--esam-ease),
    border-color 0.2s var(--esam-ease);
}
.card-hover:hover,
.card[data-batch]:hover {
  transform: translateY(-2px);
  border-color: var(--esam-line-strong);
  box-shadow: var(--esam-shadow);
}

/* =============================================================================
   Badges y estados
   ============================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  padding: 0.34em 0.62em;
  border-radius: 999px;
}
.badge i { line-height: 1; }
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.34em 0.65em;
  font-size: 0.72rem;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}
.bg-primary-subtle { background-color: rgba(4, 84, 116, 0.12) !important; }
.text-primary { color: var(--brand) !important; }
.bg-success-subtle { background-color: rgba(15, 122, 82, 0.12) !important; }
.bg-info-subtle { background-color: rgba(43, 108, 176, 0.12) !important; }
.bg-warning-subtle { background-color: rgba(180, 83, 9, 0.14) !important; }
.bg-danger-subtle { background-color: rgba(187, 59, 59, 0.12) !important; }
.bg-secondary-subtle { background-color: var(--esam-surface-3) !important; }
.bg-success, .badge.bg-success { background-color: var(--brand) !important; }
.bg-soft-success, .btn-soft-success {
  background-color: rgba(4, 84, 116, 0.1) !important;
  color: var(--brand) !important;
}
.text-success, .link-success { color: var(--brand) !important; }
.text-warning { color: var(--esam-warning) !important; }
.text-danger { color: var(--esam-danger) !important; }
.text-info { color: var(--esam-info) !important; }

/* =============================================================================
   Formularios
   ============================================================================= */
.form-label {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--esam-ink);
  margin-bottom: 0.4rem;
}
.form-control,
.form-select {
  border: 1px solid var(--esam-line-strong);
  border-radius: var(--esam-radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--esam-ink);
  background-color: var(--esam-surface);
  box-shadow: none;
  transition: border-color 0.16s var(--esam-ease), box-shadow 0.16s var(--esam-ease),
    background-color 0.16s var(--esam-ease);
}
.form-control:not(textarea):not(.form-control-sm) { min-height: 2.5rem; }
.form-control-sm:not(textarea) { min-height: 2rem; }
.form-control::placeholder { color: #93a3b8; }
.form-text { color: var(--esam-muted); font-size: 0.76rem; }
.form-control:focus,
.form-select:focus {
  border-color: var(--brand-400);
  box-shadow: var(--esam-ring);
}
.form-control:disabled,
.form-control[readonly] { background-color: var(--esam-surface-2); color: var(--esam-muted); }
.form-control-sm,
.form-select-sm { padding: 0.35rem 0.6rem; font-size: 0.8rem; border-radius: 8px; }
.form-check-input {
  border-color: var(--esam-line-strong);
  transition: background-color 0.15s var(--esam-ease), border-color 0.15s var(--esam-ease),
    box-shadow 0.15s var(--esam-ease);
}
.form-check-input:hover:not(:checked):not(:disabled) { border-color: var(--brand-400); }
.form-check-input:checked {
  background-color: var(--brand);
  border-color: var(--brand);
}
.form-check-input:focus { border-color: var(--brand-400); box-shadow: var(--esam-ring); }
.form-check-label { font-size: 0.85rem; color: var(--esam-ink-soft); }
.input-group-text {
  border-color: var(--esam-line-strong);
  background: var(--esam-surface-2);
  color: var(--esam-muted);
}

/* =============================================================================
   Tablas
   ============================================================================= */
.table {
  --vz-table-color: var(--esam-ink-soft);
  --vz-table-border-color: var(--esam-line);
  margin-bottom: 0;
}
.table > :not(caption) > * > * {
  padding: 0.78rem 1rem;
  color: var(--esam-ink-soft);
  border-bottom-color: var(--esam-line);
  vertical-align: middle;
}
.table thead th,
.table-light th {
  background: var(--esam-surface-2);
  color: var(--esam-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--esam-line);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  white-space: nowrap;
}
.table thead th:first-child { border-top-left-radius: var(--esam-radius-sm); }
.table thead th:last-child { border-top-right-radius: var(--esam-radius-sm); }
.table tbody td:first-child { padding-left: 1rem; }
.table-hover > tbody > tr {
  transition: background-color 0.14s var(--esam-ease);
}
.table-hover > tbody > tr:hover > * {
  --vz-table-accent-bg: var(--esam-surface-2);
  background-color: var(--esam-surface-2);
}
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table-responsive { border-radius: 0; }
.table .avatar-xs,
.table .avatar-sm { vertical-align: middle; }

/* =============================================================================
   Progreso
   ============================================================================= */
.progress {
  height: 8px;
  border-radius: 999px;
  background-color: var(--esam-surface-3);
  overflow: hidden;
}
.progress-sm { height: 6px; }
.progress-bar {
  background: linear-gradient(90deg, var(--brand), var(--brand-400));
  border-radius: 999px;
  transition: width 0.5s var(--esam-ease);
}
.progress-bar.bg-success { background: linear-gradient(90deg, var(--brand), var(--brand-400)) !important; }

/* =============================================================================
   Alertas
   ============================================================================= */
.alert {
  border: 1px solid transparent;
  border-radius: var(--esam-radius-sm);
  padding: 0.85rem 1rem;
  font-size: 0.86rem;
}
.alert-success {
  background: rgba(15, 122, 82, 0.1);
  border-color: rgba(15, 122, 82, 0.22);
  color: #0b5c3e;
}
.alert-danger {
  background: rgba(187, 59, 59, 0.1);
  border-color: rgba(187, 59, 59, 0.22);
  color: #8f2d2d;
}
.alert i { vertical-align: -1px; }

/* =============================================================================
   Shell · cabecera
   ============================================================================= */
#page-topbar {
  background: var(--esam-surface);
  border-bottom: 1px solid var(--esam-line);
  box-shadow: none;
}
#page-topbar .navbar-header { min-height: 64px; }
.header-item { height: 64px; }

.topbar-user .btn { border-radius: var(--esam-radius-sm); padding: 0.3rem 0.5rem; }
.topbar-user .btn:hover { background: var(--esam-surface-2); }
.user-name-text { font-weight: 600; color: var(--esam-ink); }
.user-name-sub-text { color: var(--esam-muted); }
.avatar-xs.rounded-circle,
.avatar-sm.rounded-circle { border-radius: 50% !important; }

.dropdown-menu {
  border: 1px solid var(--esam-line);
  border-radius: var(--esam-radius-sm);
  box-shadow: var(--esam-shadow);
  padding: 0.35rem;
}
.dropdown-item {
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
}
.dropdown-item:hover { background: var(--esam-surface-2); }
.dropdown-header { font-size: 0.78rem; font-weight: 600; color: var(--esam-ink); }

/* =============================================================================
   Shell · menú lateral
   ============================================================================= */
.app-menu.navbar-menu,
[data-sidebar="dark"] .app-menu.navbar-menu {
  background: linear-gradient(180deg, #082136 0%, #04162c 100%);
  box-shadow: none;
}
.app-menu .navbar-brand-box { min-height: 64px; }
.app-menu .navbar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: #a7b6cc;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.58rem 0.75rem;
  border-radius: 10px;
  margin: 0.1rem 0;
  position: relative;
  transition: color 0.16s var(--esam-ease), background-color 0.16s var(--esam-ease);
}
.app-menu .navbar-nav .nav-link i {
  font-size: 1.1rem;
  width: 1.35rem;
  text-align: center;
  color: #8199b8;
  transition: color 0.16s var(--esam-ease);
}
.app-menu .navbar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.app-menu .navbar-nav .nav-link:hover i { color: #cfe2f5; }
.app-menu .navbar-nav .nav-link.active,
.app-menu .navbar-nav .menu-link.active {
  color: #fff;
  font-weight: 600;
  background: linear-gradient(90deg, rgba(46, 144, 181, 0.28), rgba(46, 144, 181, 0.08));
  box-shadow: inset 0 0 0 1px rgba(120, 190, 220, 0.22);
}
.app-menu .navbar-nav .nav-link.active i { color: #bfe4f4; }
.app-menu .navbar-nav .nav-link.active::after {
  content: "";
  position: absolute;
  right: 0.75rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 10px rgba(230, 221, 94, 0.7);
}
.app-menu .navbar-nav .menu-title {
  color: #64789a !important;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.9rem 0.75rem 0.4rem;
}
.app-menu .navbar-nav .menu-title span { color: #64789a; }
.app-menu .logo-lg b { color: #fff; letter-spacing: 0.2px; }
.app-menu .logo-lg .text-success { color: var(--signal) !important; }
.app-menu .navbar-brand-box .logo-sm i { color: var(--signal) !important; }

/* =============================================================================
   Shell · contenido y cabecera de página
   ============================================================================= */
html, body { overflow-x: hidden; }
body { min-width: 0; }
/* El shell ocupa siempre el alto del viewport: el contenido crece y el footer
   queda pegado al borde inferior aunque la página tenga poco contenido. */
#layout-wrapper {
  width: 100%;
  max-width: 100%;
  padding-left: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.main-content {
  background: var(--esam-canvas);
  min-width: 0;
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-height: 100vh;
}
.main-content > .page-content { flex: 1 0 auto; }
.main-content > .footer { margin-top: auto; flex-shrink: 0; }
.container-fluid { min-width: 0; }
/* Padding inferior justo para no dejar hueco grande antes del footer. */
.page-content { padding-bottom: 0.4rem; }

/* Al colapsar el menú, Velzon aplica `min-height: 1400px` al documento y pasa
   el menú a posición absoluta; eso estiraba la página al pulsar la hamburguesa.
   Limitamos el alto al viewport y mantenemos el menú colapsado fijo. */
@media (min-width: 768px) {
  html[data-layout="vertical"][data-sidebar-size="sm"] { min-height: 100vh; }
  html[data-layout="vertical"][data-sidebar-size="sm"] .app-menu.navbar-menu {
    position: fixed;
    top: 0;
    bottom: 0;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }
}

/* Ítem activo del menú lateral (más claro y amigable) */
.app-menu .navbar-nav .nav-link.menu-link { position: relative; border-radius: 10px; }
.app-menu .navbar-nav .nav-link.menu-link.active {
  background: linear-gradient(90deg, rgba(46, 144, 181, 0.3), rgba(46, 144, 181, 0.08));
  box-shadow: inset 0 0 0 1px rgba(120, 190, 220, 0.18);
  color: #fff;
  font-weight: 600;
}
.app-menu .navbar-nav .nav-link.menu-link.active i { color: var(--signal); }
.app-menu .navbar-nav .nav-link.menu-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 62%;
  border-radius: 0 3px 3px 0;
  background: var(--signal);
}
.app-menu .navbar-nav .nav-link.menu-link:hover { background: rgba(255, 255, 255, 0.07); }
.app-menu .navbar-nav .nav-link.menu-link .badge { margin-left: auto; }
/* El badge del menú existe siempre y se oculta con el atributo `hidden`; sin
   esta regla, el `display: inline-flex` de `.badge` lo dejaría visible en 0. */
.app-menu .navbar-nav .nav-link.menu-link .badge[hidden] { display: none !important; }

.page-title-box {
  padding-bottom: 1.1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--esam-line);
}
.page-title-box h4 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.page-subtitle {
  color: var(--esam-muted);
  font-size: 0.85rem;
  margin: 0.3rem 0 0;
  max-width: 72ch;
}
.page-title-box .breadcrumb { font-size: 0.78rem; }
.page-title-box .breadcrumb-item a {
  color: var(--esam-muted);
  text-decoration: none;
}
.page-title-box .breadcrumb-item a:hover { color: var(--brand); }
.page-title-box .breadcrumb-item.active { color: var(--brand); font-weight: 600; }
.page-title-box .breadcrumb-item + .breadcrumb-item::before { color: var(--esam-line-strong); }

.footer {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  height: auto;
  background: var(--esam-surface);
  border-top: 1px solid var(--esam-line);
  color: var(--esam-muted);
  font-size: 0.8rem;
  padding: 0;
  margin-top: 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  padding: 0.9rem 0;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}
.footer-mark {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: rgba(4, 84, 116, 0.1);
  color: var(--brand);
  flex-shrink: 0;
}
.footer-name {
  font-weight: 600;
  color: var(--esam-ink);
  font-size: 0.82rem;
  white-space: nowrap;
}
.footer-sep {
  width: 1px;
  height: 1rem;
  background: var(--esam-line-strong);
  flex-shrink: 0;
}
.footer-note {
  color: var(--esam-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.footer-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.footer-copy { color: var(--esam-muted); white-space: nowrap; }
.footer-version {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.74rem;
  color: var(--esam-muted);
  background: var(--esam-surface-3);
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
}
html[data-bs-theme="dark"] .footer { background: var(--esam-surface); }
html[data-bs-theme="dark"] .footer-mark { background: rgba(79, 179, 214, 0.14); color: #4fb3d6; }

@media (max-width: 575.98px) {
  .footer-inner { justify-content: center; text-align: center; }
  .footer-note { white-space: normal; }
}

#back-to-top {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: var(--esam-shadow);
  border-radius: 50%;
  width: 40px;
  height: 40px;
}
#back-to-top:hover { background: var(--brand-500); border-color: var(--brand-500); }

/* =============================================================================
   Tarjetas de métrica (stat)
   ============================================================================= */
.stat-card {
  transition: border-color 0.2s var(--esam-ease), box-shadow 0.2s var(--esam-ease),
    transform 0.2s var(--esam-ease);
}
.stat-card:hover {
  border-color: var(--esam-line-strong);
  box-shadow: var(--esam-shadow-sm);
  transform: translateY(-1px);
}
.stat-card .card-body { padding: 1.1rem 1.2rem; }
.stat-card .stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--esam-muted);
  margin-bottom: 0.25rem;
  overflow-wrap: normal;
  word-break: normal;
}
.stat-card .stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.08;
  color: var(--esam-ink);
  letter-spacing: -0.025em;
}
.stat-ico {
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

/* =============================================================================
   Estados vacíos
   ============================================================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  gap: 0.4rem;
}
.empty-state .empty-ico {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--brand);
  background: rgba(4, 84, 116, 0.09);
  box-shadow: inset 0 0 0 1px rgba(4, 84, 116, 0.12);
  margin-bottom: 0.7rem;
}
.empty-state h6 { color: var(--esam-ink); margin: 0; font-size: 0.95rem; font-weight: 650; }
.empty-state p { color: var(--esam-muted); max-width: 46ch; margin: 0; font-size: 0.85rem; }
html[data-bs-theme="dark"] .empty-state .empty-ico {
  color: #4fb3d6;
  background: rgba(79, 179, 214, 0.12);
  box-shadow: inset 0 0 0 1px rgba(79, 179, 214, 0.2);
}

/* =============================================================================
   Utilidades propias
   ============================================================================= */
.ff-monospace {
  font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.85rem;
}
.mono-chip {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.8rem;
  background: var(--esam-surface-2);
  border: 1px solid var(--esam-line);
  border-radius: 7px;
  padding: 0.12rem 0.45rem;
  color: var(--esam-ink-soft);
}

/* =============================================================================
   Autenticación (login)
   ============================================================================= */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: var(--esam-canvas);
}
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3.5rem 4rem;
  color: #eaf2fb;
  background:
    radial-gradient(1200px 500px at 15% 10%, rgba(46, 144, 181, 0.35), transparent 60%),
    linear-gradient(160deg, #071f3a 0%, #041324 100%);
}
.auth-brand .auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 2.5rem;
}
.auth-brand .auth-logo i {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  background: rgba(230, 221, 94, 0.16);
  color: var(--signal);
}
.auth-brand h1 {
  color: #fff;
  font-size: 2rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.025em;
  max-width: 20ch;
  margin-bottom: 0.9rem;
}
.auth-brand p {
  color: #a9bdd6;
  font-size: 0.95rem;
  max-width: 46ch;
  margin-bottom: 2rem;
}
.auth-points {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}
.auth-points li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: #cbd9ea;
}
.auth-points li i {
  color: var(--signal);
  font-size: 1.05rem;
}
.auth-pattern {
  position: absolute;
  right: -60px;
  bottom: -60px;
  width: 380px;
  height: 380px;
  opacity: 0.5;
  pointer-events: none;
}
.auth-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
}
.auth-card { width: 100%; max-width: 400px; }
.auth-card .auth-mobile-logo {
  display: none;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: var(--esam-ink);
  margin-bottom: 1.75rem;
}
.auth-card .auth-mobile-logo i {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--signal);
  background: var(--navy-900);
}
.auth-card h2 {
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}
.auth-card .auth-lead {
  color: var(--esam-muted);
  font-size: 0.88rem;
  margin-bottom: 1.75rem;
}
.auth-hint {
  text-align: center;
  color: var(--esam-muted);
  font-size: 0.78rem;
  margin-top: 1.75rem;
}

@media (max-width: 991.98px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-card .auth-mobile-logo { display: inline-flex; }
}

/* =============================================================================
   Página de error simple
   ============================================================================= */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--esam-canvas);
}
.error-card {
  max-width: 460px;
  width: 100%;
  text-align: center;
  padding: 2.5rem 2rem;
}
.error-card .empty-ico { margin: 0 auto 1rem; }

/* Visor de imágenes */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(6, 12, 20, 0.88);
  padding: 2.5rem;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background-color 0.15s var(--esam-ease);
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.28); }

.sticker-thumb {
  height: 52px;
  background: #fff;
  border-radius: 8px;
  padding: 2px;
  border: 1px solid var(--esam-line);
}

/* QR */
#qr-box .qr {
  background: #fff;
  padding: 12px;
  border-radius: 12px;
  display: inline-block;
  box-shadow: var(--esam-shadow-sm);
  border: 1px solid var(--esam-line);
}
#qr-box .qr img { display: block; width: 240px; height: 240px; }

/* Avatares institucionales */
.avatar-xs, .avatar-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.avatar-xs { width: 2.15rem; height: 2.15rem; font-size: 0.82rem; }
.avatar-sm { width: 2.6rem; height: 2.6rem; font-size: 0.95rem; }
.av-0 { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.av-1 { background: linear-gradient(135deg, #2563eb, #4f46e5); }
.av-2 { background: linear-gradient(135deg, #9333ea, #db2777); }
.av-3 { background: linear-gradient(135deg, #d97706, #ea580c); }
.av-4 { background: linear-gradient(135deg, #e11d48, #b91c1c); }
.av-5 { background: linear-gradient(135deg, #0891b2, #0284c7); }
.av-6 { background: linear-gradient(135deg, #65a30d, #059669); }
.av-7 { background: linear-gradient(135deg, #c026d3, #7c3aed); }

.unread-badge { font-size: 0.68rem; min-width: 1.3rem; }

/* =============================================================================
   Inbox · conversaciones (modo operación)
   Paleta institucional Seguimiento ESAM · navy / azul / acento amarillo.
   Tres columnas: lista · hilo · ficha del contacto. Sin estados ni asignación.
   ============================================================================= */
.inbox {
  --ib-brand: #045474;
  --ib-brand-deep: #06203f;
  --ib-brand-soft: rgba(4, 84, 116, 0.09);
  --ib-line: #e6ebf1;
  --ib-surface: #ffffff;
  --ib-surface-2: #f6f8fb;
  --ib-surface-3: #eef2f7;
  --ib-ink: #101828;
  --ib-ink-soft: #475467;
  --ib-ink-mute: #98a2b3;
  --ib-accent: #e6dd5e;

  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 320px;
  /* Altura acotada al viewport (cabecera + paddings + footer ya en flujo). */
  height: min(760px, calc(100dvh - 210px));
  min-height: 420px;
  margin-bottom: 0.4rem;
  overflow: hidden;
  border: 1px solid var(--ib-line);
  border-radius: 16px;
  background: var(--ib-surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 18px 40px -24px rgba(6, 32, 63, 0.35);
}

/* Inbox en modo oscuro */
html[data-bs-theme="dark"] .inbox {
  --ib-brand: #4fb3d6;
  --ib-brand-deep: #0b2b3d;
  --ib-brand-soft: rgba(79, 179, 214, 0.14);
  --ib-line: #23324a;
  --ib-surface: #121c2b;
  --ib-surface-2: #0f1826;
  --ib-surface-3: #1d2a3d;
  --ib-ink: #f1f5fb;
  --ib-ink-soft: #c4cfdd;
  --ib-ink-mute: #8fa0b6;
  --ib-accent: #e6dd5e;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 40px -24px rgba(0, 0, 0, 0.75);
}
.inbox.contact-hidden { grid-template-columns: 320px minmax(0, 1fr); }
.inbox.contact-hidden .contact-panel { display: none !important; }
.inbox.list-hidden { grid-template-columns: 64px minmax(0, 1fr) 320px; }
.inbox.list-hidden.contact-hidden { grid-template-columns: 64px minmax(0, 1fr); }
.inbox:not(.list-hidden) .list-rail { display: none; }
.inbox.list-hidden .chatlist { display: none; }

/* Riel de la lista colapsada */
.inbox .list-rail {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.4rem;
  border: 0;
  border-right: 1px solid var(--ib-line);
  background: var(--ib-surface-2);
  color: var(--ib-ink-mute);
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}
.inbox .list-rail:hover { background: var(--ib-surface-3); color: var(--ib-brand); }
.inbox .list-rail span:first-child { font-size: 1.3rem; }
.inbox .list-rail .rail-label {
  writing-mode: vertical-rl;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ── Columna 1: lista de conversaciones ── */
.inbox .chatlist {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--ib-line);
  background: var(--ib-surface-2);
}
.inbox .chatlist-head {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem 1rem 0.5rem;
}
.inbox .cl-title { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-width: 0; }
.inbox .cl-title h6 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ib-ink);
}
.inbox .cl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ib-brand);
  box-shadow: 0 0 0 3px var(--ib-brand-soft);
}
.inbox .cl-session {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  background: var(--ib-brand-soft);
  color: var(--ib-brand);
  font-size: 0.66rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11rem;
}
.inbox .chatlist-head select {
  border: 0;
  background: var(--ib-surface);
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ib-ink-soft);
  padding: 0.3rem 1.6rem 0.3rem 0.6rem;
  box-shadow: inset 0 0 0 1px var(--ib-line);
}
.inbox .chatlist-search {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0.75rem 0.5rem;
  padding: 0.5rem 0.7rem;
  background: var(--ib-surface);
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px var(--ib-line);
  transition: box-shadow 0.16s ease;
}
.inbox .chatlist-search:focus-within { box-shadow: inset 0 0 0 1.5px var(--ib-brand); }
.inbox .chatlist-search .ri-search-line { color: var(--ib-ink-mute); font-size: 0.95rem; }
.inbox .chatlist-search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 0.84rem;
  color: var(--ib-ink);
}
.inbox .chatlist-search input::placeholder { color: var(--ib-ink-mute); }
.inbox .cl-clear {
  border: 0;
  background: transparent;
  color: var(--ib-ink-mute);
  cursor: pointer;
  display: inline-flex;
  padding: 0;
}
.inbox .cl-clear:hover { color: var(--ib-ink); }

.inbox .chatlist-items { flex: 1; min-height: 0; overflow-y: auto; padding: 0 0.6rem 0.75rem; }
.inbox .chatlist-items::-webkit-scrollbar { width: 10px; }
.inbox .chatlist-items::-webkit-scrollbar-thumb {
  background: rgba(4, 84, 116, 0.18);
  border-radius: 999px;
  border: 3px solid var(--ib-surface-2);
}
.inbox .chatlist-items::-webkit-scrollbar-track { background: transparent; }

/* Fila de conversación */
.convo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.68rem 0.7rem;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.convo + .convo { margin-top: 2px; }
.convo:hover { background: var(--ib-surface); box-shadow: inset 0 0 0 1px var(--ib-line); }
.convo.active {
  background: var(--ib-surface);
  box-shadow: inset 0 0 0 1.5px var(--ib-brand), 0 6px 16px -12px rgba(6, 32, 63, 0.5);
}
.convo.active::before {
  content: '';
  position: absolute;
  left: -0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 26px;
  border-radius: 0 3px 3px 0;
  background: var(--ib-brand);
}
.convo .convo-body { flex: 1; min-width: 0; }
.convo .convo-top { display: flex; align-items: baseline; gap: 0.4rem; }
.convo .convo-name {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ib-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.convo.unread .convo-name { font-weight: 700; }
.convo .convo-time { font-size: 0.68rem; color: var(--ib-ink-mute); flex-shrink: 0; }
.convo .convo-last {
  font-size: 0.78rem;
  color: var(--ib-ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}
.convo.unread .convo-last { color: var(--ib-ink); font-weight: 500; }
.convo .unread-pill {
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--ib-brand);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.convo .convo-phone-mini { display: none; }

.inbox .cl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.3rem;
  padding: 2.5rem 1.2rem;
  color: var(--ib-ink-mute);
}
.inbox .cl-empty span { font-size: 2rem; color: var(--ib-brand); opacity: 0.55; }
.inbox .cl-empty p { margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--ib-ink-soft); }
.inbox .cl-empty small { font-size: 0.74rem; }

/* ── Columna 2: hilo ── */
.chat-col {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--ib-surface);
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--ib-line);
  background: var(--ib-surface);
}
.chat-header .chat-id { min-width: 0; flex: 1; }
.chat-header .chat-id .name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ib-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-header .chat-id .sub {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--ib-ink-mute);
}
.chat-header .chat-actions { display: flex; align-items: center; gap: 0.4rem; }
.typing-hint { color: var(--ib-brand); font-style: italic; font-weight: 500; }

/* Buscar dentro de la conversación */
.chat-search { border-bottom: 1px solid var(--ib-line); background: var(--ib-surface); padding: 0.5rem 1rem; flex-shrink: 0; }
.cs-bar { display: flex; align-items: center; gap: 0.4rem; }
.cs-ico { color: var(--ib-ink-mute); font-size: 1rem; }
.cs-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--ib-line);
  border-radius: 9px;
  padding: 0 0.55rem;
  font-size: 0.82rem;
  background: var(--ib-surface-2);
  color: var(--ib-ink);
}
.cs-input:focus { outline: 0; border-color: var(--ib-brand); background: var(--ib-surface); box-shadow: 0 0 0 3px var(--ib-brand-soft); }
.cs-count { font-size: 0.72rem; color: var(--ib-ink-mute); white-space: nowrap; }
.cs-nav, .cs-close {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ib-ink-mute);
  cursor: pointer;
  flex-shrink: 0;
}
.cs-nav:hover, .cs-close:hover { background: var(--ib-brand-soft); color: var(--ib-brand); }
.cs-results {
  margin-top: 0.45rem;
  max-height: 42vh;
  overflow-y: auto;
  border: 1px solid var(--ib-line);
  border-radius: 10px;
  background: var(--ib-surface);
}
.cs-hit {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--ib-line);
  background: transparent;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}
.cs-hit:last-child { border-bottom: 0; }
.cs-hit:hover { background: var(--ib-brand-soft); }
.cs-hit.is-active { background: var(--ib-brand-soft); box-shadow: inset 3px 0 0 var(--ib-brand); }
.cs-hit-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.64rem;
  color: var(--ib-ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.cs-hit-text {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--ib-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cs-hit-text mark { background: rgba(230, 221, 94, 0.5); color: inherit; padding: 0 0.1rem; border-radius: 3px; }
html[data-bs-theme="dark"] .cs-hit-text mark { background: rgba(230, 221, 94, 0.32); }

.chat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background:
    radial-gradient(circle at 1px 1px, rgba(4, 84, 116, 0.045) 1px, transparent 0) 0 0 / 22px 22px,
    var(--ib-surface-2);
}
.chat-body::-webkit-scrollbar { width: 10px; }
.chat-body::-webkit-scrollbar-thumb {
  background: rgba(4, 84, 116, 0.18);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::before { content: ''; margin-top: auto; }
html[data-bs-theme="dark"] .chat-body { background: #0d1420; }

/* Separador de día */
.day-sep { display: flex; justify-content: center; margin: 0.5rem 0 0.3rem; }
.day-sep span {
  background: var(--ib-surface);
  color: var(--ib-ink-mute);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.22rem 0.85rem;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

/* Burbujas */
.bubble-row { display: flex; align-items: flex-end; gap: 0.35rem; }
.bubble-row.in { justify-content: flex-start; }
.bubble-row.out { justify-content: flex-end; }
.bubble-wrap { display: flex; flex-direction: column; max-width: 74%; min-width: 0; }
.bubble-row.out .bubble-wrap { align-items: flex-end; }
.bubble-row.in .bubble-wrap { align-items: flex-start; }
.bubble-author {
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--ib-brand);
  margin: 0 0.45rem 0.12rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bubble {
  padding: 0.5rem 0.75rem 0.32rem;
  border-radius: 14px;
  background: var(--ib-surface);
  color: var(--ib-ink);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.07);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
  min-width: 0;
  line-height: 1.38;
  font-size: 0.9rem;
}
html[data-bs-theme="dark"] .bubble { background: #1c2634; color: #e6edf3; }
.bubble-row.in .bubble { border-top-left-radius: 5px; }
.bubble-row.out .bubble {
  background: linear-gradient(180deg, #eaf3f6, #e2eef3);
  border: 1px solid rgba(4, 84, 116, 0.14);
  border-top-right-radius: 5px;
}
html[data-bs-theme="dark"] .bubble-row.out .bubble { background: #123243; border-color: rgba(120, 190, 220, 0.16); }
.bubble .bubble-text { display: block; }
/* Autor dentro de la burbuja (grupos), como en WhatsApp. */
.bubble .bubble-author { display: block; margin: 0 0 0.18rem; }
.bubble .bubble-author-link { cursor: pointer; }
.bubble .bubble-author-link:hover { text-decoration: underline; }
/* Monospace de WhatsApp (```texto```). */
.bubble .bubble-text code, .bubble code {
  font-family: var(--bs-font-monospace, ui-monospace, SFMono-Regular, Menlo, monospace);
  background: rgba(4, 84, 116, 0.1);
  border-radius: 4px;
  padding: 0 0.24rem;
  font-size: 0.86em;
}
html[data-bs-theme="dark"] .bubble code { background: rgba(120, 190, 220, 0.16); }
/* Adjuntos: la imagen/video van pegados al borde de la burbuja. */
.bubble.has-media { padding: 0.24rem 0.24rem 0.3rem; }
.bubble.has-media .bubble-text { margin: 0 0.42rem; }
.bubble.has-media .meta { margin-right: 0.42rem; }
/* Stickers: solo la figura, sin caja (como WhatsApp). */
.bubble-row .bubble.has-sticker { background: transparent; border: 0; box-shadow: none; padding: 0.1rem; position: relative; }
html[data-bs-theme="dark"] .bubble-row .bubble.has-sticker { background: transparent; }
.bubble.has-sticker .bubble-author { margin: 0 0.25rem 0.12rem; }
.bubble.has-sticker .meta {
  position: absolute;
  right: 0.35rem;
  bottom: 0.08rem;
  margin: 0;
  background: rgba(6, 32, 63, 0.4);
  color: #fff;
  border-radius: 999px;
  padding: 0.04rem 0.45rem;
}
.bubble.has-sticker .reactions { margin-left: 0.2rem; }
.bubble .meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  color: var(--ib-ink-mute);
  font-size: 0.62rem;
  margin-top: 0.14rem;
}
.bubble .meta .tick { font-variant-numeric: tabular-nums; }
.bubble-row.out .bubble .meta { color: #5b7a86; }
.bubble .reactions {
  display: inline-flex;
  align-items: center;
  gap: 0.05rem;
  margin-left: 0.3rem;
  background: var(--ib-surface);
  border-radius: 999px;
  padding: 0.02rem 0.24rem;
  font-size: 0.76rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.1);
}
.bubble .reactions .rx-chip {
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  padding: 0.06rem 0.16rem;
  border-radius: 999px;
  line-height: 1;
  font-size: 0.76rem;
  cursor: pointer;
}
.bubble .reactions .rx-chip:hover { background: var(--ib-brand-soft); }
.bubble .reactions .rx-num { font-size: 0.6rem; font-weight: 700; color: var(--ib-ink-mute); }

/* Quién reaccionó (se abre al pulsar una reacción) */
.rx-pop {
  position: fixed;
  z-index: 1085;
  min-width: 180px;
  max-width: 280px;
  padding: 0.5rem 0.6rem 0.55rem;
  border-radius: 12px;
  background: var(--ib-surface, #ffffff);
  color: var(--ib-ink, #101828);
  border: 1px solid var(--ib-line, #e4e7ec);
  box-shadow: 0 16px 40px -14px rgba(6, 32, 63, 0.5);
  font-size: 0.74rem;
}
.rx-pop-title {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  font-weight: 600;
  color: var(--ib-ink-soft, #475467);
  margin-bottom: 0.34rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--ib-line, #e4e7ec);
}
.rx-pop-title .rx-pop-emoji { font-size: 1rem; line-height: 1; }
.rx-pop-row { display: flex; align-items: center; gap: 0.45rem; padding: 0.2rem 0; }
.rx-pop-av {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ib-brand-soft, #e8f2f7);
  color: var(--ib-brand, #045474);
  font-size: 0.6rem; font-weight: 700;
  flex: 0 0 auto;
}
.rx-pop-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.rx-pop-name { color: var(--ib-ink, #101828); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-pop-phone { color: var(--ib-ink-mute, #98a2b3); font-size: 0.66rem; font-variant-numeric: tabular-nums; }
html[data-bs-theme="dark"] .rx-pop { background: #1d2a3d; color: #e6edf3; border-color: #2a3a52; box-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.7); }
html[data-bs-theme="dark"] .rx-pop .rx-pop-title { color: #c4cfdd; border-bottom-color: #2a3a52; }
html[data-bs-theme="dark"] .rx-pop .rx-pop-name { color: #f1f5fb; }
html[data-bs-theme="dark"] .rx-pop .rx-pop-phone { color: #8fa0b6; }
html[data-bs-theme="dark"] .rx-pop .rx-pop-av { background: rgba(79, 179, 214, 0.16); color: #cfe4ff; }

/* Cita */
.quote {
  background: rgba(4, 84, 116, 0.07);
  border-radius: 8px;
  padding: 0.32rem 0.6rem;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  color: var(--ib-ink-soft);
  overflow: hidden;
}
.quote .quote-title {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: var(--ib-brand);
}
.quote .quote-title::before { content: '\21A9'; font-size: 0.7rem; }
.quote .quote-body { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote .quote-info { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.64rem; margin-top: 0.12rem; }
.quote-author { font-weight: 700; color: var(--ib-brand); }
.quote-wa { color: var(--ib-ink-soft); }
.quote-tap { color: var(--ib-ink-mute); }
.quote-contact-link { cursor: pointer; }
.quote-contact-link:hover { text-decoration: underline; }
.quote-wa.quote-contact-link { color: var(--ib-brand); font-weight: 600; }

/* Autor de burbuja en grupos: clic para abrir su conversación */
.bubble-author-link { cursor: pointer; }
.bubble-author-link:hover { text-decoration: underline; }

/* Números de WhatsApp dentro del texto: clic para abrir conversación */
.bubble-text .phone-link {
  color: var(--ib-brand);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  cursor: pointer;
}
.bubble-text .phone-link:hover { text-decoration: underline; }

/* Documento con descarga */
.bubble .doc-card {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(4, 84, 116, 0.07);
  border-radius: 10px;
  padding: 0.3rem 0.4rem 0.3rem 0.55rem;
}
.bubble .doc-open { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; color: inherit; flex: 1; min-width: 0; }
.bubble .doc-open .ic { font-size: 1.3rem; color: var(--ib-brand); }
.bubble .doc-meta { display: flex; flex-direction: column; min-width: 0; }
.bubble .doc-meta .nm { font-weight: 600; font-size: 0.82rem; word-break: break-all; }
.bubble .doc-meta .doc-sub { font-size: 0.64rem; color: var(--ib-ink-mute); }
.bubble .doc-download {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ib-brand); color: #fff; text-decoration: none;
}
.bubble .doc-download:hover { filter: brightness(1.1); }
html[data-bs-theme="dark"] .bubble .doc-card { background: rgba(120, 190, 220, 0.12); }

/* Acciones al hover */
.bubble-actions { position: relative; display: flex; gap: 0.15rem; opacity: 0; transition: opacity 0.14s ease; }
.bubble-row:hover .bubble-actions, .bubble-row:focus-within .bubble-actions { opacity: 1; }
.bubble-actions button {
  border: 0;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--ib-surface);
  color: var(--ib-ink-mute);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.14s ease, transform 0.14s ease;
}
.bubble-actions button:hover { color: var(--ib-brand); transform: translateY(-1px); }
.bubble-actions .w-icon { width: 15px; height: 15px; }
.bubble-actions .emoji-pop {
  position: absolute;
  bottom: 32px;
  padding: 0.28rem 0.42rem;
  border-radius: 999px;
  background: var(--ib-surface);
  border: 1px solid var(--ib-line);
  box-shadow: 0 12px 28px -12px rgba(6, 32, 63, 0.45);
  z-index: 12;
}
.bubble-actions .emoji-pop .emoji-row { display: flex; gap: 0.15rem; align-items: center; }
.bubble-actions.out .emoji-pop { right: 0; }
.bubble-actions.in .emoji-pop { left: 0; }
.bubble-actions .emoji-pop button { box-shadow: none; font-size: 1rem; width: 27px; height: 27px; padding: 0; border: 0; background: transparent; border-radius: 8px; cursor: pointer; line-height: 1; }
.bubble-actions .emoji-pop button:hover { background: var(--ib-brand-soft); }
.bubble-actions .emoji-pop .emoji-more { color: var(--ib-brand); display: grid; place-items: center; }
.bubble-actions .emoji-pop .emoji-grid { display: none; }
.bubble-actions .emoji-pop.wide { border-radius: 16px; }
.bubble-actions .emoji-pop.wide .emoji-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  justify-items: center;
  gap: 0.14rem;
  max-height: 196px;
  overflow-y: auto;
  margin-top: 0.34rem;
}

/* Medios */
.bubble img.media { max-width: 280px; max-height: 340px; border-radius: 10px; display: block; cursor: zoom-in; }
.bubble img.sticker { max-width: 150px; max-height: 150px; display: block; cursor: zoom-in; }
/* Mientras se baja de WhatsApp: un recuadro suave en vez de un hueco roto. */
.bubble.has-sticker a.media-pending img { min-width: 116px; min-height: 116px; border-radius: 10px; background: rgba(4, 84, 116, 0.08); }
.bubble.has-media a.media-pending img { background: rgba(4, 84, 116, 0.08); border-radius: 10px; }
.bubble video { max-width: 300px; max-height: 360px; border-radius: 10px; display: block; }
.bubble audio { max-width: 220px; height: 34px; margin-bottom: 0.2rem; }

/* Nota de voz con controles propios (sigue sonando al cambiar de conversación) */
.audio-msg {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 210px;
  max-width: 300px;
  padding: 0.15rem 0;
  margin-bottom: 0.1rem;
}
.audio-msg .am-play {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--ib-brand);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: filter 0.14s ease, transform 0.14s ease;
}
.audio-msg .am-play:hover { filter: brightness(1.08); transform: translateY(-1px); }
.audio-msg.active .am-play { background: var(--ib-brand-deep); }
.audio-msg .am-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.audio-msg .am-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(4, 84, 116, 0.18);
  cursor: pointer;
  overflow: hidden;
}
.audio-msg .am-bar { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--ib-brand); transition: width 0.12s linear; }
.audio-msg .am-info { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.audio-msg .am-label { font-size: 0.66rem; font-weight: 600; color: var(--ib-ink-mute); }
.audio-msg .am-time { font-size: 0.66rem; color: var(--ib-ink-mute); font-variant-numeric: tabular-nums; }
html[data-bs-theme="dark"] .audio-msg .am-track { background: rgba(255, 255, 255, 0.14); }

/* Barra flotante del audio que sigue sonando en otra conversación */
.audio-dock {
  position: fixed;
  left: 1rem;
  bottom: 5.6rem;
  z-index: 1080;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: min(340px, 80vw);
  padding: 0.4rem 0.5rem;
  border-radius: 14px;
  background: var(--ib-surface);
  border: 1px solid var(--ib-line);
  box-shadow: 0 16px 34px -16px rgba(6, 32, 63, 0.5);
  animation: ad-in 0.18s ease;
}
.audio-dock[hidden] { display: none; }
@keyframes ad-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.audio-dock .ad-toggle {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--ib-brand);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.audio-dock .ad-open {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  padding: 0;
}
.audio-dock .ad-title,
.audio-dock .ad-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-dock .ad-title { font-size: 0.76rem; font-weight: 700; color: var(--ib-ink); }
.audio-dock .ad-sub { font-size: 0.66rem; color: var(--ib-ink-mute); font-variant-numeric: tabular-nums; }
.audio-dock .ad-close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--ib-ink-mute);
  cursor: pointer;
  font-size: 1.05rem;
  padding: 0.2rem;
  border-radius: 8px;
}
.audio-dock .ad-close:hover { color: var(--ib-ink); background: var(--ib-surface-3); }

/* Vista previa de un enlace de YouTube dentro de la burbuja */
.bubble-text .yt-card {
  display: block;
  width: 100%;
  max-width: 300px;
  margin-top: 0.4rem;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--ib-surface-2);
  border: 1px solid var(--ib-line);
  cursor: pointer;
  text-align: left;
  white-space: normal;
  font: inherit;
  color: inherit;
}
.bubble-text .yt-card:hover { box-shadow: 0 6px 18px -10px rgba(6, 32, 63, 0.5); }
.bubble-text .yt-card .yt-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #0f1826; }
.bubble-text .yt-card .yt-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bubble-text .yt-card .yt-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(6, 32, 63, 0.72);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.14s ease, background 0.14s ease;
}
.bubble-text .yt-card:hover .yt-play { transform: scale(1.08); background: #cc0000; }
.bubble-text .yt-card.yt-no-thumb .yt-thumb { display: none; }
.bubble-text .yt-card .yt-meta { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.5rem 0.6rem; }
.bubble-text .yt-card .yt-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ib-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bubble-text .yt-card .yt-sub { font-size: 0.68rem; color: var(--ib-ink-mute); display: flex; align-items: center; gap: 0.3rem; }
.bubble-text .yt-card .yt-sub .ri-youtube-fill { color: #cc0000; }

/* Ventana del reproductor de YouTube */
.yt-player {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(6, 12, 22, 0.78);
  backdrop-filter: blur(2px);
}
.yt-player.open { display: flex; }
.yt-player .ytp-inner {
  width: min(880px, 100%);
  background: var(--ib-surface);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, 0.7);
}
.yt-player .ytp-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--ib-line); }
.yt-player .ytp-title {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ib-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.yt-player .ytp-link,
.yt-player .ytp-close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--ib-ink-mute);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem;
  border-radius: 8px;
  text-decoration: none;
}
.yt-player .ytp-link:hover,
.yt-player .ytp-close:hover { color: var(--ib-ink); background: var(--ib-surface-3); }
.yt-player .ytp-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.yt-player .ytp-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.bubble .transcript {
  font-size: 0.72rem;
  font-style: italic;
  border-left: 2px solid currentColor;
  padding-left: 0.45rem;
  opacity: 0.82;
  margin-top: 0.25rem;
}
.bubble .doc-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  background: rgba(4, 84, 116, 0.07);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
}
.bubble .doc-link .ic { font-size: 1.1rem; color: var(--ib-brand); }
.bubble .doc-link .nm { font-weight: 600; word-break: break-all; font-size: 0.82rem; }
/* Adjunto no disponible (caducado o borrado en WhatsApp) */
.bubble .media-missing {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 220px;
  max-width: 300px;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  border: 1px dashed rgba(4, 84, 116, 0.28);
  background: rgba(4, 84, 116, 0.05);
  color: var(--ib-ink-mute);
}
.bubble .media-missing .mm-ic { font-size: 1.25rem; line-height: 1; opacity: 0.7; }
.bubble .media-missing .mm-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.bubble .media-missing .mm-title { font-size: 0.8rem; font-weight: 600; color: var(--ib-ink, inherit); }
.bubble .media-missing .mm-sub { font-size: 0.72rem; }
.bubble .media-missing .mm-retry {
  border: 0;
  background: transparent;
  color: var(--ib-accent-ink, #045474);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.15rem 0.3rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.bubble .media-missing .mm-retry:hover { background: rgba(4, 84, 116, 0.1); }
.bubble .media-missing .mm-retry:disabled { opacity: 0.6; cursor: progress; }
.bubble .media-missing.mm-unfetched { border-style: solid; }
html[data-bs-theme="dark"] .bubble .media-missing { border-color: rgba(120, 190, 220, 0.3); background: rgba(120, 190, 220, 0.08); }
html[data-bs-theme="dark"] .bubble .media-missing .mm-retry { color: #8fd0ea; }

/* Imagen que se está bajando de WhatsApp (offline/historial) */
.bubble .media-pending { display: block; min-width: 160px; min-height: 120px; border-radius: 10px; background: rgba(4, 84, 116, 0.08); }
.bubble .media-pending img { opacity: 0; }

/* Estado vacío del hilo */
.chat-empty-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.5rem;
  text-align: center;
  padding: 2rem;
  color: var(--ib-ink-mute);
}
.chat-empty-col .ce-glow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 22px;
  background: linear-gradient(160deg, var(--ib-brand-soft), rgba(230, 221, 94, 0.16));
  color: var(--ib-brand);
  font-size: 2rem;
  margin-bottom: 0.4rem;
}
.chat-empty-col h5 { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ib-ink); letter-spacing: -0.01em; }
.chat-empty-col p { margin: 0; font-size: 0.84rem; max-width: 34ch; }

/* ── Compositor ── */
.composer { border-top: 1px solid var(--ib-line); padding: 0.7rem 1rem 0.9rem; background: var(--ib-surface); position: relative; }
.composer .reply-preview {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--ib-surface-2);
  border: 1px solid var(--ib-line);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.55rem;
  font-size: 0.75rem;
}
.composer .reply-preview .rp-title {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ib-brand);
}
.composer .reply-preview .rp-title::before { content: '\21A9'; font-size: 0.7rem; }
.composer .reply-preview .rp-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ib-ink-soft);
}
.composer .reply-preview button { border: 0; background: transparent; cursor: pointer; color: var(--ib-ink-mute); }
.composer .reply-preview button:hover { color: var(--ib-ink); }
/* Imagen pegada (captura de pantalla) esperando confirmación. */
.composer .attach-preview {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--ib-surface-2);
  border: 1px solid var(--ib-line);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.55rem;
}
.composer .attach-preview .ap-thumb {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(127, 127, 127, 0.12);
  border: 1px solid var(--ib-line);
}
.composer .attach-preview .ap-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.composer .attach-preview .ap-info { flex: 1; min-width: 0; }
.composer .attach-preview .ap-title { font-size: 0.76rem; font-weight: 700; color: var(--ib-ink); }
.composer .attach-preview .ap-sub { font-size: 0.7rem; color: var(--ib-ink-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer .attach-preview .ap-hint { font-size: 0.66rem; color: var(--ib-ink-mute); margin-top: 0.15rem; }
.composer .attach-preview .ap-cancel {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ib-ink-mute);
  cursor: pointer;
}
.composer .attach-preview .ap-cancel:hover { background: rgba(127, 127, 127, 0.16); color: var(--ib-ink); }
.composer-row { display: flex; gap: 0.5rem; align-items: flex-end; }
.composer-row .btn-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 0;
  flex-shrink: 0;
}
/* Herramientas del compositor: fila propia para no quitarle ancho al texto. */
.composer-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.composer-tools .btn-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 0;
  flex-shrink: 0;
}
.composer-tools .recorder { min-height: 34px; padding: 0.2rem 0.35rem; }
.composer-tools .composer-emoji { margin-left: auto; }
.composer-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 62px;
  resize: none;
  max-height: 180px;
  border-radius: 12px;
  line-height: 1.45;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--ib-line);
  background: var(--ib-surface-2);
  /* Color de texto del tema: sin esto heredaba blanco y en modo claro no se leía. */
  color: var(--ib-ink);
  caret-color: var(--ib-ink);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.composer-input::placeholder { color: var(--ib-ink-mute, #98a2b3); opacity: 1; }
.composer-input:focus { border-color: var(--ib-brand); background: var(--ib-surface); color: var(--ib-ink); box-shadow: 0 0 0 3px var(--ib-brand-soft); }
.btn-send { border-radius: 12px; }
.composer-field { position: relative; flex: 1; min-width: 0; }
.composer .quick-pop, .composer .emoji-pop2 {
  position: absolute;
  bottom: calc(100% + 0.45rem);
  left: 0;
  z-index: 20;
  width: min(320px, calc(100vw - 2rem));
  max-height: 260px;
  overflow-y: auto;
  background: var(--ib-surface);
  border: 1px solid var(--ib-line);
  border-radius: 12px;
  box-shadow: 0 18px 40px -20px rgba(6, 32, 63, 0.5);
  padding: 0.4rem;
}
.composer .emoji-pop2 { left: auto; right: 0; width: 244px; display: block; max-height: 224px; overflow-y: auto; }
.composer .emoji-pop2 .emoji-sec {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.2rem 0.24rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ib-ink-mute);
}
.composer .emoji-pop2 .emoji-sec-row,
.composer .emoji-pop2 .emoji-all { display: flex; flex-wrap: wrap; gap: 0.15rem; }
.composer .emoji-pop2 .emoji-sec-row { padding-bottom: 0.3rem; margin-bottom: 0.24rem; border-bottom: 1px solid var(--ib-line); }
.composer .quick-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 0.45rem 0.55rem; border-radius: 8px; cursor: pointer; }
.composer .quick-item:hover { background: var(--ib-brand-soft); }
.composer .quick-item code { background: rgba(4, 84, 116, 0.12); color: var(--ib-brand); border-radius: 6px; padding: 0.05rem 0.38rem; font-size: 0.68rem; font-weight: 700; }
.composer .quick-item p { margin: 0.22rem 0 0; font-size: 0.75rem; color: var(--ib-ink-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer .emoji-btn { border: 0; background: transparent; font-size: 1.2rem; line-height: 1; padding: 0.28rem; border-radius: 8px; cursor: pointer; }
.composer .emoji-btn:hover { background: var(--ib-brand-soft); }
.recorder { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.55rem; border-radius: 10px; background: var(--ib-surface-3); font-size: 0.75rem; }
.recorder.rec { background: #fee2e2; color: #b91c1c; }

/* ── Columna 3: ficha del contacto ── */
.contact-panel {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--ib-line);
  background: var(--ib-surface-2);
  overflow-y: auto;
}
.contact-panel .contact-head {
  text-align: center;
  padding: 1.4rem 1rem 1.1rem;
  border-bottom: 1px solid var(--ib-line);
  background: linear-gradient(180deg, rgba(4, 84, 116, 0.06), transparent);
}
.contact-panel .contact-head .avatar-xl { margin: 0 auto; }
.contact-panel .contact-name { font-weight: 700; color: var(--ib-ink); margin-top: 0.7rem; }
.contact-panel .contact-phone { font-size: 0.8rem; color: var(--ib-ink-soft); font-variant-numeric: tabular-nums; }
.contact-panel .contact-email { font-size: 0.74rem; color: var(--ib-ink-mute); margin-top: 0.1rem; }
.contact-panel .panel-section { padding: 0.9rem 1rem; border-bottom: 1px solid var(--ib-line); }
.contact-panel .panel-section h6 {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ib-ink-mute);
  font-weight: 700;
  margin-bottom: 0.6rem;
}
.note-item {
  background: #fffbeb;
  border: 1px solid #fef0c7;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.5rem;
}
.note-item p { margin: 0; font-size: 0.78rem; color: var(--ib-ink); white-space: pre-wrap; }
.note-item .note-author { font-size: 0.64rem; color: var(--ib-ink-mute); margin-top: 0.28rem; }
.note-item audio { width: 100%; margin-top: 0.28rem; height: 32px; }
.contact-meta dl { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 0.6rem; font-size: 0.78rem; margin: 0; }
.contact-meta dt { color: var(--ib-ink-mute); }
.contact-meta dd { margin: 0; text-align: right; font-weight: 600; color: var(--ib-ink-soft); }

/* Solapas de la ficha: Información / Grupos */
.contact-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 0.2rem;
  padding: 0.45rem 0.75rem 0;
  background: var(--ib-surface-2);
  border-bottom: 1px solid var(--ib-line);
}
.contact-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  flex: 1;
  min-width: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ib-ink-mute);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.45rem 0.35rem 0.5rem;
  cursor: pointer;
}
.contact-tab:hover { color: var(--ib-ink); }
.contact-tab.active { color: var(--ib-brand); border-bottom-color: var(--ib-brand); }
.contact-tab-count {
  min-width: 1.1rem;
  padding: 0.02rem 0.32rem;
  border-radius: 999px;
  background: var(--ib-brand-soft);
  color: var(--ib-brand);
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}
.contact-groups { padding: 0.8rem 0.75rem 1rem; }
.cg-hint { margin: 0 0 0.55rem; font-size: 0.68rem; line-height: 1.4; color: var(--ib-ink-mute); }
.cg-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1.2rem 0.5rem;
  font-size: 0.76rem;
  color: var(--ib-ink-mute);
}
.cg-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 1.4rem 0.8rem;
  text-align: center;
  color: var(--ib-ink-mute);
}
.cg-empty > .ri-group-line { font-size: 1.5rem; opacity: 0.65; }
.cg-empty p { margin: 0.2rem 0 0; font-size: 0.78rem; color: var(--ib-ink-soft); }
.cg-empty small { font-size: 0.68rem; line-height: 1.35; }
.cg-list { display: flex; flex-direction: column; gap: 0.35rem; }
.cg-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  border: 1px solid var(--ib-line);
  border-radius: 10px;
  background: var(--ib-surface);
  padding: 0.5rem 0.55rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.cg-item:hover { border-color: var(--ib-brand); background: var(--ib-brand-soft); }
.cg-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--ib-brand-soft);
  color: var(--ib-brand);
}
.cg-main { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 0.1rem; }
.cg-name { font-size: 0.76rem; font-weight: 600; color: var(--ib-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-meta { font-size: 0.64rem; color: var(--ib-ink-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-go { color: var(--ib-ink-mute); flex-shrink: 0; }

.avatar-xl {
  width: 4rem;
  height: 4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}

/* Toast */
.inbox-toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  background: var(--ib-brand-deep, #06203f);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  font-size: 0.82rem;
  box-shadow: 0 18px 40px -18px rgba(6, 32, 63, 0.7);
  animation: ib-toast-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.inbox-toast.err { background: #b42318; }
@keyframes ib-toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Selección y foco accesibles */
.inbox ::selection { background: rgba(4, 84, 116, 0.2); }
.inbox :focus-visible { outline: 2px solid var(--ib-brand); outline-offset: 2px; }

/* Ajustes de superficies claras en modo oscuro */
html[data-bs-theme="dark"] .chat-body {
  background:
    radial-gradient(circle at 1px 1px, rgba(120, 190, 220, 0.05) 1px, transparent 0) 0 0 / 22px 22px,
    var(--ib-surface-2);
}
html[data-bs-theme="dark"] .bubble .reactions { background: rgba(0, 0, 0, 0.32); }
html[data-bs-theme="dark"] .bubble-actions button { background: #1d2a3d; color: #8fa0b6; }
html[data-bs-theme="dark"] .bubble-actions button:hover { color: var(--ib-brand); }
html[data-bs-theme="dark"] .bubble-actions .emoji-pop { background: #1d2a3d; border-color: var(--ib-line); }
html[data-bs-theme="dark"] .note-item { background: #2a2416; border-color: #3d3418; }
html[data-bs-theme="dark"] .note-item p { color: var(--ib-ink); }
html[data-bs-theme="dark"] .recorder { background: var(--ib-surface-3); }
html[data-bs-theme="dark"] .recorder.rec { background: #3a1d1d; color: #fca5a5; }
html[data-bs-theme="dark"] .composer .quick-item code { background: rgba(120, 190, 220, 0.16); }
html[data-bs-theme="dark"] .contact-panel .contact-head { background: linear-gradient(180deg, rgba(79, 179, 214, 0.08), transparent); }
html[data-bs-theme="dark"] .quote { background: rgba(120, 190, 220, 0.1); }
html[data-bs-theme="dark"] .bubble .doc-link { background: rgba(120, 190, 220, 0.12); }
html[data-bs-theme="dark"] .inbox-toast { background: #0f1826; }

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

/* =============================================================================
   Responsive
   ============================================================================= */
@media (max-width: 991.98px) {
  /* Una sola columna: se reinician los `grid-column` explícitos para que el
     chat y la ficha no generen columnas implícitas al costado. */
  .inbox,
  .inbox.contact-hidden,
  .inbox.list-hidden,
  .inbox.list-hidden.contact-hidden { grid-template-columns: 1fr; height: auto; }
  .inbox .list-rail,
  .inbox .chatlist,
  .inbox .chat-col,
  .inbox .contact-panel { grid-column: 1; }
  .inbox .chatlist { max-height: 45vh; }
  .inbox .chat-col { min-height: 70vh; }
  .chat-card { min-height: 70vh; }
  .inbox .contact-panel { display: none; }
}

/* =============================================================================
   Áreas de trabajo (Reportes · Monitoreo · Anti-Baneo · Usuarios · Conexión)
   Refinan la jerarquía y el agrupamiento sin romper la identidad existente.
   ============================================================================= */

/* Cabecera de página con acciones */
.page-title-box .page-title-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}
.page-title-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Encabezado de sección (sustituye al anidamiento de tarjetas) */
.section-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1.6rem 0 0.9rem;
}
.section-head:first-child { margin-top: 0; }
.section-head-ico {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--brand);
  background: rgba(4, 84, 116, 0.1);
  flex-shrink: 0;
}
.section-head-body { min-width: 0; }
.section-head-body h5 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--esam-ink);
}
.section-head-body p {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: var(--esam-muted);
  max-width: 75ch;
}
.section-head-action { margin-left: auto; flex-shrink: 0; }

/* Tarjetas de métrica: soporte para texto auxiliar */
.stat-card .stat-sub {
  margin: 0.28rem 0 0;
  font-size: 0.74rem;
  color: var(--esam-muted);
  line-height: 1.35;
}
.min-w-0 { min-width: 0; }

/* Lista de datos etiqueta/valor */
.kv-list { margin: 0; }
.kv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.62rem 0;
  border-bottom: 1px solid var(--esam-line);
}
.kv-row:first-child { padding-top: 0; }
.kv-row:last-child { border-bottom: 0; padding-bottom: 0; }
.kv-row dt {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--esam-muted);
}
.kv-row dd {
  margin: 0;
  font-weight: 600;
  color: var(--esam-ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Aviso contextual */
.insight {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--esam-line);
  border-radius: var(--esam-radius-sm);
  background: var(--esam-surface-2);
  margin-bottom: 1rem;
}
.insight .insight-ico { font-size: 1.15rem; flex-shrink: 0; line-height: 1.3; }
.insight.is-good .insight-ico { color: var(--esam-success); }
.insight.is-warn .insight-ico { color: var(--esam-warning); }
.insight.is-info .insight-ico { color: var(--esam-brand, var(--brand)); }
.insight p { margin: 0; font-size: 0.84rem; color: var(--esam-ink-soft); }
.insight p b { color: var(--esam-ink); }

/* Panel de conexión (Conexión) */
.conn-hero { display: flex; flex-direction: column; gap: 1rem; }
.conn-status {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--esam-line);
  border-radius: var(--esam-radius);
  background: var(--esam-surface-2);
}
.conn-status .conn-ico {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.conn-status.is-on .conn-ico { background: rgba(15, 122, 82, 0.12); color: var(--esam-success); }
.conn-status.is-off .conn-ico { background: rgba(180, 83, 9, 0.12); color: var(--esam-warning); }
.conn-status .conn-body { min-width: 0; flex: 1; }
.conn-status .conn-title { font-weight: 650; color: var(--esam-ink); font-size: 1rem; }
.conn-status .conn-sub { font-size: 0.82rem; color: var(--esam-muted); margin-top: 0.15rem; }
.conn-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Modal de confirmación: desvincular número */
#unlink-modal .modal-content { border: 0; border-radius: 16px; box-shadow: var(--esam-shadow-lg, 0 24px 48px -20px rgba(14, 26, 43, 0.3)); }
#unlink-modal .modal-title { font-size: 1.05rem; font-weight: 700; }
.unlink-ico {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
  color: var(--esam-danger, #bb3b3b); background: rgba(187, 59, 59, 0.1);
}
.unlink-target {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  padding: 0.55rem 0.75rem; border-radius: 10px; margin-bottom: 0.85rem;
  background: var(--esam-surface-2, #f6f8fb); border: 1px solid var(--esam-line, #e6ebf1); font-size: 0.86rem;
}
.unlink-target .ri-whatsapp-line { color: #25a35a; font-size: 1.05rem; }
.unlink-list { margin: 0 0 0.85rem; padding-left: 1.1rem; font-size: 0.84rem; color: var(--esam-ink-soft, #475467); }
.unlink-list li + li { margin-top: 0.35rem; }
.unlink-hint {
  font-size: 0.8rem; padding: 0.55rem 0.7rem; border-radius: 10px;
  color: var(--esam-ink-soft, #475467); background: rgba(4, 84, 116, 0.07);
}
html[data-bs-theme="dark"] .unlink-hint { background: rgba(108, 195, 227, 0.1); }

/* Barra de filtros / herramientas */
.toolbar .toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}
.toolbar .toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.toolbar .toolbar-field > label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--esam-muted);
  margin: 0;
}
.toolbar .toolbar-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Agrupamiento de formularios largos (Anti-Baneo) */
.policy-group { padding-top: 1.1rem; margin-top: 1.1rem; border-top: 1px solid var(--esam-line); }
.policy-group:first-of-type { padding-top: 0; margin-top: 0; border-top: 0; }
.policy-legend {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--esam-muted);
}
.policy-legend i { font-size: 0.95rem; color: var(--brand); }

/* Fila de usuario */
.user-cell { display: flex; align-items: center; gap: 0.65rem; }
.user-cell .user-name { font-weight: 600; color: var(--esam-ink); line-height: 1.2; }
.user-cell .user-mail { font-size: 0.75rem; color: var(--esam-muted); }
.user-cell .user-meta { font-size: 0.75rem; color: var(--esam-muted); }

/* Modo oscuro */
html[data-bs-theme="dark"] .section-head-ico {
  background: rgba(79, 179, 214, 0.14);
  color: #4fb3d6;
}
html[data-bs-theme="dark"] .conn-status.is-on .conn-ico { background: rgba(52, 199, 143, 0.16); color: #4dd4a0; }
html[data-bs-theme="dark"] .conn-status.is-off .conn-ico { background: rgba(240, 168, 92, 0.16); color: #f0a85c; }
html[data-bs-theme="dark"] .policy-legend i { color: #4fb3d6; }
html[data-bs-theme="dark"] .insight.is-info .insight-ico { color: #4fb3d6; }
html[data-bs-theme="dark"] .insight.is-good .insight-ico { color: #4dd4a0; }
html[data-bs-theme="dark"] .insight.is-warn .insight-ico { color: #f0a85c; }

@media (max-width: 575.98px) {
  .page-title-box .page-title-right { align-items: flex-start; }
  .page-title-actions { justify-content: flex-start; }
  .section-head { align-items: flex-start; }
  .section-head-action { margin-left: 0; width: 100%; }
}

/* Grupos: marca e identificacion en el inbox */
.group-ico { color: var(--esam-brand, var(--brand)); font-size: 0.9em; margin-right: 0.3rem; vertical-align: -0.05em; }
.avatar-sm.is-group, .avatar-xs.is-group { border-radius: 30% !important; }
.bubble-author { font-weight: 600; }

/* Solapas de la lista: Numeros / Grupos */
.cl-tabs { display: flex; gap: 0.35rem; padding: 0 0.75rem 0.45rem; }
.cl-tab {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--ib-line, #e6ebf1);
  border-radius: 10px;
  background: var(--ib-surface-2, #f6f8fb);
  color: var(--ib-ink-soft, #475467);
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.cl-tab:hover { color: var(--ib-brand, #045474); }
.cl-tab.active { background: var(--ib-brand, #045474); border-color: var(--ib-brand, #045474); color: #fff; }
.cl-tab-count {
  min-width: 1.15rem; padding: 0 0.32rem; border-radius: 999px;
  background: rgba(16, 24, 40, 0.08); font-size: 0.7rem; font-weight: 700;
}
.cl-tab.active .cl-tab-count { background: rgba(255, 255, 255, 0.25); color: #fff; }
.cl-tab.has-unread .cl-tab-count { background: var(--ib-accent, #e6dd5e); color: #06203f; }

/* Cargando mensajes anteriores (paginación hacia atrás) */
.older-loading {
  text-align: center;
  font-size: 0.76rem;
  color: var(--ib-ink-mute, #98a2b3);
  padding: 0.5rem 0;
}

/* Cita clickeable + resaltado del mensaje citado */
.quote-clickable { cursor: pointer; transition: background 0.14s ease; }
.quote-clickable:hover { background: rgba(4, 84, 116, 0.13); }
.bubble-row.bubble-highlight .bubble { box-shadow: 0 0 0 2px var(--ib-brand, #045474); }

/* Miembros del grupo (ficha de contacto) */
.members-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--ib-surface-2, #f6f8fb);
  border: 1px solid var(--ib-line, #e6ebf1);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  margin-bottom: 0.45rem;
}
.members-search .ri-search-line { color: var(--ib-ink-mute, #98a2b3); font-size: 0.9rem; }
.members-search input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.78rem;
  color: var(--ib-ink, #101828);
}
.members-list {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}
.member-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.32rem 0.4rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--ib-ink, #101828);
}
.member-item:hover { background: var(--ib-brand-soft, rgba(4, 84, 116, 0.09)); }
.member-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.member-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}
.member-num { font-size: 0.72rem; color: var(--ib-ink-mute, #98a2b3); }
/* Datos de la persona en la ficha del grupo: compañero y programas. */
.member-tags { display: flex; flex-wrap: wrap; gap: 0.18rem; margin-top: 0.12rem; }
.member-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.14rem;
  max-width: 100%;
  padding: 0.02rem 0.38rem;
  border-radius: 999px;
  font-size: 0.62rem;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-tag.team { color: #0e9f6e; background: rgba(14, 159, 110, 0.11); }
.member-tag.prog {
  color: var(--ib-brand, #045474);
  background: var(--ib-brand-soft, rgba(4, 84, 116, 0.09));
}
html[data-bs-theme="dark"] .member-tag.team { color: #6ee7b7; background: rgba(14, 159, 110, 0.18); }
html[data-bs-theme="dark"] .member-tag.prog { color: #9ecbdd; background: rgba(4, 84, 116, 0.35); }
.member-full {
  display: flex;
  align-items: center;
  gap: 0.18rem;
  margin-top: 0.08rem;
  font-size: 0.68rem;
  color: var(--ib-ink-soft, #475467);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-full .ri-user-star-line { color: var(--ib-brand, #045474); }
/* Lista global de personas registradas por cronogramas (solapa Contactos). */
.dir-group-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin: 0.45rem 0.75rem 0.2rem;
  padding-top: 0.45rem;
  border-top: 1px dashed var(--ib-line, #e6ebf1);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ib-ink-mute, #98a2b3);
}
.dir-group-title small {
  flex-basis: 100%;
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.convo.dir-row .dir-new { color: var(--ib-brand, #045474); font-style: italic; }
.dir-more {
  margin: 0.35rem 0.75rem 0.6rem;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--ib-ink-mute, #98a2b3);
}
.cl-tab-count.total { background: rgba(4, 84, 116, 0.12); }
.cl-tab.active .cl-tab-count.total { background: rgba(255, 255, 255, 0.25); }
.member-admin {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ib-brand, #045474);
  background: var(--ib-brand-soft, rgba(4, 84, 116, 0.09));
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
}
.member-msg { color: var(--ib-ink-mute, #98a2b3); opacity: 0.55; }
html[data-bs-theme="dark"] .member-item { color: #e6edf3; }
html[data-bs-theme="dark"] .member-admin { color: #4fb3d6; background: rgba(79, 179, 214, 0.14); }

/* =============================================================================
   Notas internas · componentes compartidos (ficha del contacto y /notes)
   Una nota = un detalle del contacto + (opcional) un seguimiento con fecha.
   ============================================================================= */
.nk-section, .notes-page {
  --nk-brand: #045474;
  --nk-brand-soft: rgba(4, 84, 116, 0.09);
  --nk-danger: var(--esam-danger, #bb3b3b);
  --nk-danger-soft: rgba(187, 59, 59, 0.1);
  --nk-warn: var(--esam-warning, #b45309);
  --nk-warn-soft: rgba(180, 83, 9, 0.1);
  --nk-ok: var(--esam-success, #0f7b55);
  --nk-ok-soft: rgba(15, 123, 85, 0.1);
  --nk-line: var(--esam-line, #e6ebf1);
  --nk-surface: var(--esam-surface, #fff);
  --nk-surface-2: var(--esam-surface-2, #f6f8fb);
  --nk-ink: var(--esam-ink, #101828);
  --nk-ink-soft: var(--esam-ink-soft, #475467);
  --nk-mute: var(--esam-muted, #98a2b3);
}
html[data-bs-theme="dark"] .nk-section,
html[data-bs-theme="dark"] .notes-page {
  --nk-brand: #6cc3e3;
  --nk-brand-soft: rgba(108, 195, 227, 0.13);
  --nk-danger: #f08484;
  --nk-danger-soft: rgba(240, 132, 132, 0.13);
  --nk-warn: #f3b25f;
  --nk-warn-soft: rgba(243, 178, 95, 0.13);
  --nk-ok: #5fd3a6;
  --nk-ok-soft: rgba(95, 211, 166, 0.13);
}

.nk-hint { font-size: 0.7rem; color: var(--nk-mute); }
.nk-hint a { color: var(--nk-brand); }
.nk-field-label {
  font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--nk-mute); margin: 0.6rem 0 0.3rem;
}

/* Chips de etiqueta (selector) y etiquetas (lectura) */
.nk-tag-picker { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.nk-chip {
  border: 1px solid currentColor; background: transparent; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600; padding: 0.16rem 0.6rem; line-height: 1.35; cursor: pointer;
  transition: transform 0.12s var(--esam-ease, ease), opacity 0.12s ease;
}
.nk-chip:not(.on) { opacity: 0.8; }
.nk-chip:hover { opacity: 1; transform: translateY(-1px); }
.nk-chip:focus-visible, .nk-due-chip:focus-visible { outline: 2px solid var(--nk-brand); outline-offset: 2px; }
.nk-tag {
  --tag: #045474;
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.68rem; font-weight: 600; line-height: 1.4; padding: 0.1rem 0.5rem; border-radius: 999px;
  color: var(--tag); background: color-mix(in srgb, var(--tag) 13%, transparent);
}
.nk-tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--tag); }
html[data-bs-theme="dark"] .nk-tag { color: color-mix(in srgb, var(--tag) 55%, #fff); background: color-mix(in srgb, var(--tag) 26%, transparent); }

/* Selector de fecha de seguimiento: atajos + fecha libre */
.nk-due-picker { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.nk-due-chip, .nk-due-custom {
  border: 1px solid var(--nk-line); background: var(--nk-surface); color: var(--nk-ink-soft);
  border-radius: 8px; font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.55rem; cursor: pointer; line-height: 1.4;
}
.nk-due-chip:hover, .nk-due-custom:hover { border-color: var(--nk-brand); color: var(--nk-brand); }
.nk-due-chip.on, .nk-due-custom.on { background: var(--nk-brand-soft); border-color: var(--nk-brand); color: var(--nk-brand); }
.nk-due-custom { display: inline-flex; align-items: center; gap: 0.3rem; padding-top: 0.1rem; padding-bottom: 0.1rem; }
.nk-due-input { border: 0; background: transparent; color: inherit; font: inherit; font-size: 0.72rem; outline: none; width: 7.6rem; }

.nk-textarea { font-size: 0.86rem; line-height: 1.5; resize: none; border-radius: 10px; min-height: 4.2rem; }

/* Tarjeta de nota */
.nk-card {
  position: relative;
  border: 1px solid var(--nk-line);
  border-radius: 12px;
  background: var(--nk-surface);
  padding: 0.65rem 0.7rem 0.6rem;
  transition: border-color 0.15s ease, box-shadow 0.18s var(--esam-ease, ease), background 0.15s ease;
}
.nk-card + .nk-card { margin-top: 0.5rem; }
.nk-card:hover { box-shadow: var(--esam-shadow-sm, 0 2px 6px -2px rgba(14, 26, 43, 0.08)); }
.nk-card.nk-overdue { border-color: color-mix(in srgb, var(--nk-danger) 45%, var(--nk-line)); background: color-mix(in srgb, var(--nk-danger) 4%, var(--nk-surface)); }
.nk-card.nk-today { border-color: color-mix(in srgb, var(--nk-warn) 45%, var(--nk-line)); }
.nk-card.nk-done { background: var(--nk-surface-2); }
.nk-card.nk-done .nk-text { color: var(--nk-mute); }
.nk-card.editing { border-color: var(--nk-brand); box-shadow: var(--esam-ring, 0 0 0 3px rgba(4, 84, 116, 0.16)); }

.nk-row { display: flex; gap: 0.55rem; align-items: flex-start; }
.nk-main { flex: 1; min-width: 0; }
.nk-text { margin: 0; font-size: 0.85rem; line-height: 1.5; color: var(--nk-ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.nk-text a { color: var(--nk-brand); }
.nk-card audio { width: 100%; height: 32px; margin-top: 0.3rem; }
.nk-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.45rem; }
.nk-meta { display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; margin-top: 0.4rem; font-size: 0.68rem; color: var(--nk-mute); }
.nk-meta-item { display: inline-flex; align-items: center; gap: 0.25rem; }
.nk-done-by { color: var(--nk-ok); font-weight: 600; }

/* Botón de completar (círculo) */
.nk-check {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 0.08rem; padding: 0;
  border: 1.5px solid var(--nk-line); border-radius: 50%; background: var(--nk-surface);
  color: transparent; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem; cursor: pointer;
  transition: border-color 150ms var(--esam-ease-out), color 150ms var(--esam-ease-out),
    background-color 150ms var(--esam-ease-out);
}
.nk-check:hover { border-color: var(--nk-ok); color: var(--nk-ok); background: var(--nk-ok-soft); }
.nk-check.on { border-color: var(--nk-ok); background: var(--nk-ok); color: #fff; }
.nk-check:focus-visible, .nk-icon:focus-visible { outline: 2px solid var(--nk-brand); outline-offset: 2px; }
.nk-overdue .nk-check { border-color: color-mix(in srgb, var(--nk-danger) 60%, var(--nk-line)); }

/* Fecha de seguimiento */
.nk-due {
  display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap;
  font-size: 0.68rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 999px;
  color: var(--nk-ink-soft); background: var(--nk-surface-2);
}
.nk-due-overdue { color: var(--nk-danger); background: var(--nk-danger-soft); }
.nk-due-today { color: var(--nk-warn); background: var(--nk-warn-soft); }
.nk-due-soon { color: var(--nk-brand); background: var(--nk-brand-soft); }
.nk-due-done { color: var(--nk-mute); background: transparent; padding-left: 0; font-weight: 600; }

/* Acciones (visibles al pasar el cursor o con foco; siempre en pantallas táctiles) */
.nk-actions {
  position: absolute; top: 0.4rem; right: 0.4rem; display: flex; gap: 0.1rem; padding: 0.1rem;
  border-radius: 9px; background: var(--nk-surface); box-shadow: var(--esam-shadow-sm, 0 2px 6px rgba(0, 0, 0, 0.08));
  opacity: 0; transition: opacity 0.15s ease;
}
.nk-actions:empty { display: none; }
.nk-card:hover .nk-actions, .nk-card:focus-within .nk-actions { opacity: 1; }
@media (hover: none) { .nk-actions { opacity: 1; } }
.nk-card.editing .nk-actions { visibility: hidden; }
.nk-icon {
  border: 0; width: 26px; height: 26px; border-radius: 7px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.92rem;
  background: transparent; color: var(--nk-mute);
}
.nk-icon:hover { background: var(--nk-surface-2); color: var(--nk-brand); }
.nk-icon.nk-del:hover { color: var(--nk-danger); background: var(--nk-danger-soft); }

.nk-editor .nk-editor-foot { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.7rem; }
.nk-editor .nk-editor-foot .nk-hint { margin-right: auto; }

/* Confirmación de borrado en línea */
.nk-confirm {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  margin-top: 0.55rem; padding: 0.5rem 0.6rem; border-radius: 9px;
  background: var(--nk-danger-soft); color: var(--nk-danger); font-size: 0.76rem; font-weight: 600;
}
.nk-confirm span { margin-right: auto; }
.nk-confirm[hidden], .nk-editor[hidden], .nk-view[hidden] { display: none; }

/* ── Ficha del contacto ── */
.contact-panel .nk-section .nk-section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.35rem; }
.contact-panel .nk-section .nk-section-head h6 { margin: 0; }
.nk-counts { display: inline-flex; gap: 0.25rem; }
.nk-count {
  font-size: 0.64rem; font-weight: 700; padding: 0.05rem 0.45rem; border-radius: 999px;
  color: var(--nk-ink-soft); background: var(--nk-surface);
  border: 1px solid var(--nk-line);
}
.nk-count.danger { color: var(--nk-danger); background: var(--nk-danger-soft); border-color: transparent; }
.nk-count.warn { color: var(--nk-warn); background: var(--nk-warn-soft); border-color: transparent; }
.nk-intro { font-size: 0.72rem; color: var(--nk-mute); margin: 0 0 0.6rem; line-height: 1.45; }

.nk-composer-collapsed {
  width: 100%; display: flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 0.7rem; border-radius: 10px; cursor: text;
  border: 1px dashed color-mix(in srgb, var(--nk-brand) 40%, var(--nk-line));
  background: var(--nk-surface); color: var(--nk-ink-soft); font-size: 0.8rem; text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.nk-composer-collapsed:hover, .nk-composer-collapsed:focus-visible { border-color: var(--nk-brand); background: var(--nk-brand-soft); color: var(--nk-brand); outline: none; }
.nk-composer {
  border: 1px solid var(--nk-brand); border-radius: 12px; padding: 0.6rem;
  background: var(--nk-surface); box-shadow: var(--esam-ring, 0 0 0 3px rgba(4, 84, 116, 0.16));
}
.nk-composer .nk-textarea { border: 0; padding: 0.15rem 0.2rem; box-shadow: none; background: transparent; }
.nk-composer .nk-textarea:focus { box-shadow: none; }
.nk-composer-foot { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.75rem; padding-top: 0.55rem; border-top: 1px solid var(--nk-line); }
.nk-composer-foot .nk-hint { margin-right: auto; }

.nk-list { margin-top: 0.75rem; }
.nk-empty { text-align: center; padding: 1rem 0.5rem 0.4rem; color: var(--nk-mute); }
.nk-empty span { font-size: 1.6rem; opacity: 0.5; }
.nk-empty p { margin: 0.2rem 0 0; font-size: 0.76rem; }
.nk-done-group { margin-top: 0.7rem; }
.nk-done-group summary {
  cursor: pointer; list-style: none; font-size: 0.7rem; font-weight: 700; color: var(--nk-mute);
  text-transform: uppercase; letter-spacing: 0.05em; padding: 0.25rem 0; display: flex; align-items: center; gap: 0.3rem;
}
.nk-done-group summary::-webkit-details-marker { display: none; }
.nk-done-group summary::before { content: '\25B8'; transition: transform 0.15s ease; }
.nk-done-group[open] summary::before { transform: rotate(90deg); }
.nk-done-group[open] summary { margin-bottom: 0.4rem; }

/* ── Página /notes ── */
.np-stats { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.6rem; margin-bottom: 1.1rem; }
.np-stat {
  --tone: var(--nk-brand); --tone-soft: var(--nk-brand-soft);
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 0.6rem; align-items: center;
  text-align: left; padding: 0.7rem 0.8rem 0.68rem 0.9rem; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--nk-line); background: var(--nk-surface); color: var(--nk-ink);
  transition: border-color 0.16s var(--esam-ease), box-shadow 0.2s var(--esam-ease), transform 0.16s var(--esam-ease);
}
/* Barra de acento a la izquierda: se enciende cuando el estado está elegido */
.np-stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tone); opacity: 0; transition: opacity 0.18s ease; }
.np-stat:hover { border-color: color-mix(in srgb, var(--tone) 40%, var(--nk-line)); box-shadow: var(--esam-shadow-sm); transform: translateY(-2px); }
.np-stat:focus-visible { outline: 2px solid var(--tone); outline-offset: 2px; }
.np-stat.on {
  border-color: color-mix(in srgb, var(--tone) 55%, var(--nk-line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 30%, transparent), var(--esam-shadow-sm);
  background: color-mix(in srgb, var(--tone) 6%, var(--nk-surface));
  transform: translateY(-1px);
}
.np-stat.on::before { opacity: 1; }
.np-stat-ic {
  grid-row: span 2; width: 34px; height: 34px; border-radius: 11px; font-size: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center; color: var(--tone); background: var(--tone-soft);
  transition: background-color 0.16s ease, transform 0.16s var(--esam-ease);
}
.np-stat:hover .np-stat-ic { transform: scale(1.06); }
.np-stat-num { font-size: 1.3rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.np-stat-label { font-size: 0.72rem; color: var(--nk-mute); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-stat.zero .np-stat-num { color: var(--nk-mute); }
.np-stat.zero .np-stat-ic { opacity: 0.55; }
.np-danger { --tone: var(--nk-danger); --tone-soft: var(--nk-danger-soft); }
.np-warn { --tone: var(--nk-warn); --tone-soft: var(--nk-warn-soft); }
.np-info { --tone: var(--nk-brand); --tone-soft: var(--nk-brand-soft); }
.np-ok { --tone: var(--nk-ok); --tone-soft: var(--nk-ok-soft); }
.np-mute { --tone: var(--nk-ink-soft); --tone-soft: var(--nk-surface-2); }
.np-stat.np-danger:not(.zero) .np-stat-num { color: var(--nk-danger); }

.np-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1.1rem; align-items: start; }
.np-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.np-toolbar .notes-search {
  display: flex; align-items: center; gap: 0.45rem; flex: 1; min-width: 220px;
  border: 1px solid var(--nk-line); border-radius: 11px; padding: 0.45rem 0.75rem; background: var(--nk-surface);
  transition: border-color 0.16s var(--esam-ease), box-shadow 0.16s var(--esam-ease), background-color 0.16s ease;
}
.np-toolbar .notes-search:hover { border-color: var(--nk-line-strong, var(--nk-line)); }
.np-toolbar .notes-search:focus-within { border-color: var(--nk-brand); box-shadow: var(--esam-ring, 0 0 0 3px rgba(4, 84, 116, 0.16)); }
.np-toolbar .notes-search span { color: var(--nk-mute); transition: color 0.16s ease; }
.np-toolbar .notes-search:focus-within span { color: var(--nk-brand); }
.np-toolbar .notes-search input { border: 0; outline: none; background: transparent; width: 100%; font-size: 0.84rem; color: var(--nk-ink); }
.np-toolbar .notes-search input::placeholder { color: var(--nk-mute); }
.np-toolbar .form-select {
  width: auto; min-width: 13.5rem; border-radius: 11px; border-color: var(--nk-line);
  font-size: 0.8rem; padding: 0.4rem 2rem 0.4rem 0.7rem; color: var(--nk-ink); background-color: var(--nk-surface);
}
.np-toolbar .form-select:focus { border-color: var(--nk-brand); box-shadow: var(--esam-ring, 0 0 0 3px rgba(4, 84, 116, 0.16)); }
/* Filtros «Registradas por mí» / «Asignadas a mí» como píldoras */
.np-mine {
  display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; font-weight: 600;
  color: var(--nk-ink-soft); white-space: nowrap; cursor: pointer; user-select: none;
  border: 1px solid var(--nk-line); background: var(--nk-surface); border-radius: 999px; padding: 0.34rem 0.7rem;
  transition: border-color 0.16s var(--esam-ease), background-color 0.16s var(--esam-ease), color 0.16s var(--esam-ease);
}
.np-mine:hover { border-color: color-mix(in srgb, var(--nk-brand) 45%, var(--nk-line)); color: var(--nk-ink); }
.np-mine .form-check-input { margin: 0; accent-color: var(--nk-brand); }
.np-mine:has(.form-check-input:checked) { border-color: var(--nk-brand); background: var(--nk-brand-soft); color: var(--nk-brand); }
.np-mine:focus-within { outline: 2px solid var(--nk-brand); outline-offset: 2px; }
.np-active { display: flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; color: var(--nk-ink-soft); }
.np-active:not(:empty) { margin-bottom: 0.75rem; }
.np-clear { border: 0; background: transparent; color: var(--nk-brand); font-size: 0.76rem; font-weight: 600; cursor: pointer; padding: 0; }
.np-clear:hover { text-decoration: underline; }

.np-list { transition: opacity 0.15s ease; }
.np-list.loading { opacity: 0.55; }
.np-group + .np-group { margin-top: 1.3rem; }
.np-group-title {
  display: flex; align-items: center; gap: 0.45rem; margin: 0 0 0.6rem;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--nk-mute);
}
/* Filete que lleva la mirada del título hasta el final de la fila */
.np-group-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--nk-line), transparent); }
.np-group-title span {
  font-size: 0.66rem; font-weight: 700; padding: 0.05rem 0.5rem; border-radius: 999px;
  background: var(--nk-surface-2); color: var(--nk-ink-soft); font-variant-numeric: tabular-nums;
}
.np-group-overdue .np-group-title { color: var(--nk-danger); }
.np-group-overdue .np-group-title span { background: var(--nk-danger-soft); color: var(--nk-danger); }
.np-group-today .np-group-title { color: var(--nk-warn); }
.np-group-today .np-group-title span { background: var(--nk-warn-soft); color: var(--nk-warn); }
.np-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0.65rem; }
.np-cards .nk-card + .nk-card { margin-top: 0; }
.notes-page .nk-card { padding: 0.75rem 0.8rem 0.7rem; transition: border-color 0.16s var(--esam-ease), box-shadow 0.2s var(--esam-ease), transform 0.16s var(--esam-ease); }
.notes-page .np-cards .nk-card:hover {
  border-color: color-mix(in srgb, var(--nk-brand) 32%, var(--nk-line));
  box-shadow: var(--esam-shadow-sm); transform: translateY(-1px);
}
.nk-contact { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--nk-line); min-width: 0; }
.nk-contact-name { font-weight: 700; font-size: 0.84rem; color: var(--nk-ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nk-contact-name:hover { color: var(--nk-brand); text-decoration: underline; }
.nk-contact-phone { font-size: 0.72rem; color: var(--nk-mute); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Placeholder mientras carga la lista: evita el salto de altura y el hueco blanco. */
.np-loading {
  display: flex; align-items: center; justify-content: center; gap: 0.55rem;
  min-height: 180px; font-size: 0.82rem; color: var(--nk-mute);
}
.np-loading-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--nk-brand);
  animation: np-pulse 1.1s var(--esam-ease-out) infinite alternate;
}
@keyframes np-pulse { from { opacity: 0.35; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .np-loading-dot { animation: none; opacity: 0.7; } }

/* Estado vacío de notas: enseña el siguiente paso en vez de dejar un hueco. */
.np-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 3.1rem 1.25rem; color: var(--nk-mute);
  border: 1px dashed var(--nk-line); border-radius: var(--esam-radius-lg);
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--nk-brand) 6%, transparent), transparent 70%),
    var(--nk-surface);
  transition: opacity 220ms var(--esam-ease-out), transform 220ms var(--esam-ease-out);
}
@starting-style {
  .np-empty { opacity: 0; transform: translateY(6px); }
}
.np-empty-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%; font-size: 1.9rem;
  color: var(--nk-brand); background: var(--nk-brand-soft);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--nk-brand) 5%, transparent);
}
.np-empty-title {
  margin: 0.9rem 0 0.3rem; font-weight: 700; color: var(--nk-ink);
  font-size: 0.98rem; letter-spacing: -0.01em; text-wrap: balance;
}
.np-empty-sub { max-width: 46ch; margin: 0; font-size: 0.8rem; line-height: 1.55; text-wrap: pretty; }
.np-empty-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 1.15rem; }
.np-empty-actions .btn { display: inline-flex; align-items: center; gap: 0.35rem; }
.np-empty.is-error { border-style: solid; border-color: color-mix(in srgb, var(--nk-danger) 35%, var(--nk-line)); }
.np-empty.is-error .np-empty-ico {
  color: var(--nk-danger); background: var(--nk-danger-soft);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--nk-danger) 5%, transparent);
}
@media (prefers-reduced-motion: reduce) {
  .np-empty { transition: none; }
}

.np-side { display: flex; flex-direction: column; gap: 0.8rem; position: sticky; top: 90px; }
.np-side-card { border: 1px solid var(--nk-line); border-radius: 14px; background: var(--nk-surface); padding: 0.85rem 0.9rem; box-shadow: var(--esam-shadow-xs); }
.np-side-card h6 {
  display: flex; align-items: center; gap: 0.35rem; margin: 0;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--nk-mute);
}
.np-side-card h6 [class^="ri-"] { color: var(--nk-brand); font-size: 0.88rem; }
.np-side-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.6rem; }
.np-tags { display: flex; flex-direction: column; gap: 0.15rem; }
.np-tag {
  display: flex; align-items: center; gap: 0.5rem; width: 100%; text-align: left;
  border: 0; background: transparent; border-radius: 9px; padding: 0.38rem 0.5rem; cursor: pointer; color: var(--nk-ink);
  transition: background-color 0.14s var(--esam-ease), color 0.14s var(--esam-ease), transform 0.14s var(--esam-ease);
}
.np-tag:hover { background: var(--nk-surface-2); transform: translateX(2px); }
.np-tag.on { background: var(--nk-brand-soft); color: var(--nk-brand); }
.np-tag:focus-visible { outline: 2px solid var(--nk-brand); outline-offset: 1px; }
.np-tag-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.np-tag-name { flex: 1; min-width: 0; font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-tag-count {
  font-size: 0.68rem; font-weight: 700; color: var(--nk-mute); font-variant-numeric: tabular-nums;
  background: var(--nk-surface-2); border-radius: 999px; padding: 0.05rem 0.45rem;
}
.np-tag.on .np-tag-count { background: var(--nk-surface); color: var(--nk-brand); }
.np-tag-count b { color: var(--nk-ink-soft); }
.np-tag.on .np-tag-count b { color: var(--nk-brand); }
.np-tag-edit { display: grid; grid-template-columns: 30px 1fr auto auto; gap: 0.3rem; align-items: center; padding: 0.2rem 0; }
.np-tag-color { width: 28px; height: 28px; padding: 0; border: 1px solid var(--nk-line); border-radius: 8px; background: transparent; cursor: pointer; }
.np-tag-confirm {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.5rem; border-radius: 8px; background: var(--nk-danger-soft); color: var(--nk-danger); font-size: 0.74rem; font-weight: 600;
}
.np-tag-confirm span { margin-right: auto; }
.np-tag-confirm[hidden], .np-tag-form[hidden] { display: none; }
.np-tag-form { margin-top: 0.7rem; padding-top: 0.6rem; border-top: 1px solid var(--nk-line); display: flex; flex-direction: column; gap: 0.45rem; }
.np-tag-form .nk-field-label { margin: 0; }
.tag-colors { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tag-color { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform 0.12s ease; }
.tag-color:hover { transform: scale(1.1); }
.tag-color.on { border-color: var(--nk-ink); box-shadow: 0 0 0 2px var(--nk-surface) inset; }
.np-tips {
  background: linear-gradient(180deg, color-mix(in srgb, var(--nk-brand) 5%, var(--nk-surface)), var(--nk-surface));
  border-color: color-mix(in srgb, var(--nk-brand) 20%, var(--nk-line));
}
.np-tips h6 [class^="ri-"] { color: var(--nk-warn); }
.np-tips ul { margin: 0.55rem 0 0; padding-left: 1.05rem; font-size: 0.76rem; color: var(--nk-ink-soft); line-height: 1.5; }
.np-tips li + li { margin-top: 0.35rem; }
.np-tip-check {
  display: inline-flex; width: 16px; height: 16px; border-radius: 50%; vertical-align: -3px;
  align-items: center; justify-content: center; font-size: 0.7rem; color: #fff; background: var(--nk-ok);
}

@media (max-width: 1399.98px) {
  .np-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  .np-layout { grid-template-columns: 1fr; }
  .np-side { position: static; order: -1; }
  .np-tips { display: none; }
}
@media (max-width: 575.98px) {
  .np-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
  .np-cards { grid-template-columns: 1fr; }
  .np-toolbar .form-select { flex: 1; min-width: 0; }
  /* En pantalla chica la búsqueda ocupa su propia fila para no quedar cortada. */
  .np-toolbar .notes-search { flex: 1 0 100%; min-width: 0; }
}

/* =============================================================================
   Seguimiento (/monitoring) y Reportes (/reports)
   ============================================================================= */
.fu-page {
  --fu-ok: var(--esam-success, #0f7b55);
  --fu-ok-soft: rgba(15, 123, 85, 0.1);
  --fu-warn: var(--esam-warning, #b45309);
  --fu-warn-soft: rgba(180, 83, 9, 0.1);
  --fu-late: var(--esam-danger, #bb3b3b);
  --fu-late-soft: rgba(187, 59, 59, 0.1);
  --fu-brand: #045474;
  --fu-mute: var(--esam-muted, #98a2b3);
  --fu-line: var(--esam-line, #e6ebf1);
}
html[data-bs-theme="dark"] .fu-page {
  --fu-ok: #5fd3a6; --fu-ok-soft: rgba(95, 211, 166, 0.13);
  --fu-warn: #f3b25f; --fu-warn-soft: rgba(243, 178, 95, 0.13);
  --fu-late: #f08484; --fu-late-soft: rgba(240, 132, 132, 0.13);
  --fu-brand: #6cc3e3;
}

/* Barra de período */
.fu-toolbar .card-body { display: flex; flex-direction: column; gap: 0.75rem; }
.fu-presets { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.fu-chip {
  display: inline-flex; align-items: center; padding: 0.3rem 0.8rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600; text-decoration: none;
  border: 1px solid var(--fu-line); color: var(--esam-ink-soft, #475467); background: var(--esam-surface, #fff);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.fu-chip:hover { border-color: var(--fu-brand); color: var(--fu-brand); }
.fu-chip.on { background: var(--fu-brand); border-color: var(--fu-brand); color: #fff; }
html[data-bs-theme="dark"] .fu-chip.on { color: #0a1220; }
.fu-chip:focus-visible { outline: 2px solid var(--fu-brand); outline-offset: 2px; }
.fu-updated { font-size: 0.72rem; color: var(--fu-mute); white-space: nowrap; }

/* Tablas de seguimiento */
.fu-contact { font-weight: 700; color: var(--esam-ink, #101828); text-decoration: none; }
.fu-contact:hover { color: var(--fu-brand); text-decoration: underline; }
.fu-sub { font-size: 0.72rem; color: var(--fu-mute); }
.fu-last { display: inline-block; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; color: var(--esam-ink-soft, #475467); }
.fu-wait {
  display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.74rem; font-weight: 700;
  padding: 0.12rem 0.55rem; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.fu-wait-ok { color: var(--fu-ok); background: var(--fu-ok-soft); }
.fu-wait-warn { color: var(--fu-warn); background: var(--fu-warn-soft); }
.fu-wait-late { color: var(--fu-late); background: var(--fu-late-soft); }
.fu-pending .table-responsive { max-height: 520px; overflow-y: auto; }
.fu-pending thead th { position: sticky; top: 0; z-index: 1; }
.fu-health { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.76rem; font-weight: 600; }
.fu-health i { font-size: 0.6rem; }
.fu-health-green { color: var(--fu-ok); }
.fu-health-yellow { color: var(--fu-warn); }
.fu-health-red { color: var(--fu-late); }

/* Seguimientos de notas */
.fu-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.fu-note {
  display: flex; flex-direction: column; gap: 0.1rem; padding: 0.55rem 0.7rem; border-radius: 10px;
  border: 1px solid var(--fu-line); background: var(--esam-surface, #fff);
}
.fu-note-overdue { border-color: color-mix(in srgb, var(--fu-late) 40%, var(--fu-line)); background: color-mix(in srgb, var(--fu-late) 4%, var(--esam-surface, #fff)); }
.fu-note-today { border-color: color-mix(in srgb, var(--fu-warn) 40%, var(--fu-line)); }
.fu-note-contact { font-weight: 700; font-size: 0.82rem; color: var(--esam-ink, #101828); text-decoration: none; }
.fu-note-contact:hover { color: var(--fu-brand); text-decoration: underline; }
.fu-note-text { font-size: 0.8rem; color: var(--esam-ink-soft, #475467); overflow-wrap: anywhere; }
.fu-note-meta { font-size: 0.7rem; font-weight: 600; color: var(--fu-mute); }
.fu-note-overdue .fu-note-meta { color: var(--fu-late); }
.fu-note-today .fu-note-meta { color: var(--fu-warn); }

/* Gráficos */
.fu-chart .card-header { display: block; }
.fu-chart-sub { font-size: 0.74rem; color: var(--fu-mute); margin-top: 0.15rem; }
.fu-chart-box { min-height: 300px; }
.fu-chart-empty {
  min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem;
  color: var(--fu-mute); font-size: 0.82rem; text-align: center;
}
.fu-chart-empty span { font-size: 1.8rem; opacity: 0.5; }

/* =============================================================================
   Refinamiento visual · detalles transversales
   Refuerza jerarquía, superficies y controles sin alterar la estructura.
   ============================================================================= */

/* Cabecera de tarjeta con acciones alineadas a la derecha. */
.card-header.d-flex { gap: 0.75rem; }
.card-header .card-title { min-width: 0; }
.card-header .btn-sm { padding: 0.32rem 0.6rem; }

/* Código y atajos: lectura clara, sin depender del estilo por defecto. */
code {
  font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.82em;
  color: var(--brand);
  background: rgba(4, 84, 116, 0.08);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
}
html[data-bs-theme="dark"] code { color: #7cc0da; background: rgba(79, 179, 214, 0.14); }

/* Avatares: anillo que los separa del fondo en cualquier superficie. */
.avatar-xs, .avatar-sm, .avatar-xl {
  box-shadow: 0 0 0 1px rgba(14, 26, 43, 0.06);
}
html[data-bs-theme="dark"] .avatar-xs,
html[data-bs-theme="dark"] .avatar-sm,
html[data-bs-theme="dark"] .avatar-xl { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08); }

/* Avisos contextuales: ícono centrado con el texto y algo más de aire. */
.insight { align-items: center; }
.insight .insight-ico { font-size: 1.2rem; }

/* Lista de pares: valor con énfasis tipográfico consistente. */
.kv-row dd { font-weight: 650; }

/* Panel de conexión: superficie interior definida y QR con marco. */
.conn-status { box-shadow: inset 0 0 0 1px rgba(4, 84, 116, 0.05); }
#qr-box { padding-top: 0.25rem; }

/* Enlaces dentro de tablas y contenido. */
.table a { color: var(--brand); text-decoration: none; font-weight: 600; }
.table a:hover { text-decoration: underline; }

/* Filas de sesión/listas simples dentro de tarjetas. */
.card .border-bottom { border-color: var(--esam-line) !important; }

/* Una tabla como único contenido llena la tarjeta (borde a borde). */
.card-body:has(> .table-responsive) { padding: 0; }
.card-body:has(> .table-responsive) > .table-responsive {
  border-radius: 0 0 var(--esam-radius) var(--esam-radius);
}
.card-body:has(> .table-responsive) .table thead th:first-child { border-top-left-radius: 0; }
.card-body:has(> .table-responsive) .table thead th:last-child { border-top-right-radius: 0; }
.card-body:has(> .table-responsive) .table tbody td:first-child { padding-left: 1.25rem; }

/* Los controles deshabilitados se leen como inactivos, no rotos. */
.form-control:disabled,
.form-select:disabled { background-color: var(--esam-surface-3); cursor: not-allowed; }

/* Píldoras de contador y etiquetas pequeñas. */
.rounded-pill.bg-danger { background-color: var(--esam-danger) !important; }

/* Tarjetas de lote: encabezado con marca, métricas en rejilla. */
.batch-ico {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  color: var(--brand);
  background: rgba(4, 84, 116, 0.1);
  flex-shrink: 0;
}
.batch-sub { font-size: 0.75rem; color: var(--esam-muted); }
.batch-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.batch-stats > div {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 0.7rem;
  border-radius: var(--esam-radius-sm);
  background: var(--esam-surface-2);
  border: 1px solid var(--esam-line);
}
.batch-stats > div > span { font-size: 0.68rem; color: var(--esam-muted); }
.batch-stats > div > b { font-size: 1rem; line-height: 1.2; }
html[data-bs-theme="dark"] .batch-ico { background: rgba(79, 179, 214, 0.14); color: #4fb3d6; }

/* Estado vacío con acción. */
.empty-action { display: flex; justify-content: center; }

/* ── Notas y tareas compartidas entre líneas: importantes, origen y avisos ── */
.nk-section, .notes-page, .inbox {
  --nk-pin: #9a5b00;
  --nk-pin-soft: rgba(217, 140, 0, 0.12);
}
html[data-bs-theme="dark"] .nk-section,
html[data-bs-theme="dark"] .notes-page,
html[data-bs-theme="dark"] .inbox {
  --nk-pin: #f5c25b;
  --nk-pin-soft: rgba(245, 194, 91, 0.14);
}

/* Tarjeta importante: franja lateral ámbar */
.nk-card.nk-pinned {
  border-color: color-mix(in srgb, var(--nk-pin) 40%, var(--nk-line));
  background: color-mix(in srgb, var(--nk-pin) 5%, var(--nk-surface));
  box-shadow: inset 3px 0 0 var(--nk-pin);
}
.nk-pin-badge {
  display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap;
  font-size: 0.68rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 999px;
  color: var(--nk-pin); background: var(--nk-pin-soft);
}
.nk-icon.nk-pin.on { color: var(--nk-pin); }
.nk-icon.nk-pin:hover { color: var(--nk-pin); background: var(--nk-pin-soft); }
.nk-origin { color: var(--nk-ink-soft); }
.nk-origin.other {
  color: var(--nk-brand); font-weight: 600;
  background: var(--nk-brand-soft); padding: 0 0.4rem; border-radius: 999px;
}
.nk-meta-item [class^="ri-"] { font-size: 0.78rem; }

/* Interruptor "Importante" del compositor */
.nk-pin-toggle {
  display: flex; align-items: center; gap: 0.55rem; margin: 0.55rem 0 0;
  padding: 0.45rem 0.55rem; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--nk-line); background: var(--nk-surface-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.nk-pin-toggle:hover { border-color: color-mix(in srgb, var(--nk-pin) 45%, var(--nk-line)); }
.nk-pin-toggle.on { border-color: var(--nk-pin); background: var(--nk-pin-soft); }
.nk-pin-input { position: absolute; opacity: 0; pointer-events: none; }
.nk-pin-switch {
  flex: 0 0 auto; position: relative; width: 30px; height: 17px; border-radius: 999px;
  background: color-mix(in srgb, var(--nk-mute) 55%, transparent); transition: background 0.15s ease;
}
.nk-pin-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s var(--esam-ease, ease);
}
.nk-pin-toggle.on .nk-pin-switch { background: var(--nk-pin); }
.nk-pin-toggle.on .nk-pin-switch::after { transform: translateX(13px); }
.nk-pin-input:focus-visible + .nk-pin-switch { outline: 2px solid var(--nk-brand); outline-offset: 2px; }
.nk-pin-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.nk-pin-text b { font-size: 0.78rem; color: var(--nk-ink); display: inline-flex; align-items: center; gap: 0.2rem; }
.nk-pin-toggle.on .nk-pin-text b { color: var(--nk-pin); }
.nk-pin-text small { font-size: 0.68rem; color: var(--nk-mute); }

/* Ficha: grupos y aviso de notas de otras líneas */
.nk-intro { display: flex; gap: 0.4rem; align-items: flex-start; }
.nk-intro [class^="ri-"] { color: var(--nk-brand); font-size: 0.9rem; line-height: 1.2; }
.nk-group-title {
  display: flex; align-items: center; gap: 0.35rem; margin: 0.75rem 0 0.4rem;
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--nk-mute);
}
.nk-list > .nk-group-title:first-child, .nk-shared-hint + .nk-group-title { margin-top: 0; }
.nk-group-title span { padding: 0 0.4rem; border-radius: 999px; background: var(--nk-surface-2); color: var(--nk-ink-soft); }
.nk-shared-hint {
  display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.6rem;
  font-size: 0.72rem; color: var(--nk-brand); background: var(--nk-brand-soft);
  padding: 0.35rem 0.55rem; border-radius: 8px;
}
.nk-empty small { display: block; font-size: 0.7rem; margin-top: 0.2rem; line-height: 1.4; }

/* /notes: indicador "Importantes" */
.np-pin { --tone: var(--nk-pin); --tone-soft: var(--nk-pin-soft); }
.np-group-pinned .np-group-title { color: var(--nk-pin); }

/* Lista de conversaciones: notas pendientes de la persona */
.convo .convo-notes {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.15rem;
  height: 20px; padding: 0 0.4rem; border-radius: 999px;
  font-size: 0.66rem; font-weight: 700; line-height: 1;
  color: var(--ib-brand); background: color-mix(in srgb, var(--ib-brand) 11%, transparent);
}
.convo .convo-notes [class^="ri-"] { font-size: 0.75rem; }
.convo .convo-notes.pin { color: var(--nk-pin); background: var(--nk-pin-soft); }
.convo .convo-notes.danger { color: var(--esam-danger, #bb3b3b); background: rgba(187, 59, 59, 0.11); }

/* Aviso fijado bajo la cabecera del chat */
.chat-notes-banner {
  --cnb: var(--nk-pin); --cnb-soft: var(--nk-pin-soft);
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.85rem; border-bottom: 1px solid color-mix(in srgb, var(--cnb) 25%, transparent);
  background: var(--cnb-soft); box-shadow: inset 3px 0 0 var(--cnb);
  font-size: 0.8rem; color: var(--ib-ink, #101828);
  animation: cnb-in 0.2s var(--esam-ease, ease);
}
.chat-notes-banner.danger { --cnb: var(--esam-danger, #bb3b3b); --cnb-soft: rgba(187, 59, 59, 0.09); }
.chat-notes-banner.warn { --cnb: var(--esam-warning, #b45309); --cnb-soft: rgba(180, 83, 9, 0.09); }
html[data-bs-theme="dark"] .chat-notes-banner.danger { --cnb: #f08484; --cnb-soft: rgba(240, 132, 132, 0.12); }
html[data-bs-theme="dark"] .chat-notes-banner.warn { --cnb: #f3b25f; --cnb-soft: rgba(243, 178, 95, 0.12); }
.chat-notes-banner .cnb-ic { flex: 0 0 auto; font-size: 1.05rem; color: var(--cnb); }
.chat-notes-banner .cnb-body {
  flex: 1; min-width: 0; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.chat-notes-banner .cnb-body b { color: var(--cnb); }
.chat-notes-banner .cnb-more, .chat-notes-banner .cnb-by {
  margin-left: 0.45rem; font-size: 0.7rem; color: var(--ib-ink-mute, #98a2b3); white-space: nowrap;
}
.chat-notes-banner .cnb-more { font-weight: 700; color: var(--cnb); }
.chat-notes-banner .cnb-open {
  flex: 0 0 auto; border: 1px solid color-mix(in srgb, var(--cnb) 45%, transparent); background: transparent;
  color: var(--cnb); font-size: 0.72rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 8px; cursor: pointer;
}
.chat-notes-banner .cnb-open:hover { background: color-mix(in srgb, var(--cnb) 12%, transparent); }
.chat-notes-banner .cnb-open:focus-visible { outline: 2px solid var(--cnb); outline-offset: 2px; }
@keyframes cnb-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .chat-notes-banner { animation: none; } }
@media (max-width: 575.98px) { .chat-notes-banner .cnb-by { display: none; } }

/* Toast con acción («Deshacer») */
.inbox-toast.has-action { display: flex; align-items: center; gap: 0.9rem; }
.inbox-toast .toast-action {
  border: 0; background: transparent; color: #8fd3ee; font: inherit; font-weight: 700;
  padding: 0.1rem 0.2rem; cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.74rem;
}
.inbox-toast .toast-action:hover { text-decoration: underline; }
.inbox-toast .toast-action:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Historial de una nota */
.nk-history {
  margin-top: 0.55rem; padding: 0.55rem 0.65rem; border-radius: 10px;
  background: var(--nk-surface-2); border: 1px solid var(--nk-line);
}
.nk-history[hidden] { display: none; }
.nk-h-head { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--nk-mute); margin-bottom: 0.4rem; }
.nk-h-list { list-style: none; margin: 0; padding: 0; position: relative; }
.nk-h-list::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 1px; background: var(--nk-line); }
.nk-h-item { position: relative; display: flex; gap: 0.5rem; font-size: 0.74rem; color: var(--nk-ink-soft); line-height: 1.45; }
.nk-h-item + .nk-h-item { margin-top: 0.45rem; }
.nk-h-item b { color: var(--nk-ink); font-weight: 600; }
.nk-h-ic {
  position: relative; flex: 0 0 auto; width: 19px; height: 19px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem;
  background: var(--nk-surface); border: 1px solid var(--nk-line); color: var(--nk-brand);
}
.nk-h-when { color: var(--nk-mute); font-size: 0.68rem; white-space: nowrap; }
.nk-h-before {
  margin-top: 0.25rem; padding: 0.35rem 0.5rem; border-left: 2px solid var(--nk-line);
  background: var(--nk-surface); border-radius: 0 6px 6px 0;
}
.nk-h-label { display: block; font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--nk-mute); }
.nk-h-prev { display: block; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--nk-ink-soft); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--nk-mute) 60%, transparent); }
.nk-h-sub { display: block; font-size: 0.66rem; color: var(--nk-mute); margin-top: 0.1rem; }

/* Nota en la papelera */
.nk-card.nk-trashed { background: var(--nk-surface-2); border-style: dashed; }
.nk-card.nk-trashed .nk-text { color: var(--nk-ink-soft); }
.nk-trash-ic { flex: 0 0 auto; color: var(--nk-mute); font-size: 1rem; margin-top: 0.05rem; }
.nk-trash-actions { display: flex; align-items: center; gap: 0.3rem; flex: 0 0 auto; }
.nk-deleted-by { color: var(--nk-danger); }

/* /notes: botón Papelera */
.np-trash-btn {
  display: inline-flex; align-items: center; gap: 0.35rem; margin-left: auto;
  border: 1px solid var(--nk-line); background: var(--nk-surface); color: var(--nk-ink-soft);
  border-radius: 10px; padding: 0.32rem 0.7rem; font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.np-trash-btn:hover { border-color: var(--nk-danger); color: var(--nk-danger); }
.np-trash-btn.on { border-color: var(--nk-danger); color: var(--nk-danger); background: var(--nk-danger-soft); }
.np-trash-btn:focus-visible { outline: 2px solid var(--nk-brand); outline-offset: 2px; }
.np-trash-count:not(:empty) {
  min-width: 18px; padding: 0 0.3rem; border-radius: 999px; font-size: 0.66rem; text-align: center;
  background: var(--nk-surface-2); color: var(--nk-ink-soft);
}

/* Responsable de la tarea */
.nk-assignee {
  display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap;
  font-size: 0.68rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 999px;
  color: var(--nk-ink-soft); background: var(--nk-surface-2); border: 1px solid var(--nk-line);
}
.nk-assignee.me { color: #fff; background: var(--nk-brand); border-color: var(--nk-brand); }
html[data-bs-theme="dark"] .nk-assignee.me { color: #06203f; }
.nk-field-hint { text-transform: none; letter-spacing: 0; font-weight: 500; }
.nk-assignee-select { font-size: 0.78rem; border-radius: 8px; max-width: 100%; }

/* Nota guardada desde un mensaje del chat */
.nk-goto {
  display: inline-flex; align-items: center; gap: 0.25rem; border: 0; background: transparent; padding: 0;
  font-size: 0.68rem; font-weight: 600; color: var(--nk-brand); cursor: pointer;
}
.nk-goto:hover { text-decoration: underline; }
.nk-goto:focus-visible { outline: 2px solid var(--nk-brand); outline-offset: 2px; border-radius: 4px; }
.nk-source {
  display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.4rem;
  padding: 0.3rem 0.5rem; border-radius: 8px; font-size: 0.72rem; font-weight: 600;
  color: var(--nk-brand); background: var(--nk-brand-soft);
}
.nk-source span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nk-source-x { border: 0; background: transparent; color: inherit; padding: 0 0.1rem; cursor: pointer; line-height: 1; }
.nk-source-x:hover { color: var(--nk-danger); }

/* ── Hora del recordatorio ── */
.nk-time {
  display: flex; align-items: center; gap: 0.35rem; margin-top: 0.4rem;
  font-size: 0.74rem; color: var(--nk-ink-soft);
}
.nk-time [class^="ri-"] { color: var(--nk-brand); }
.nk-time-input {
  border: 1px solid var(--nk-line); border-radius: 8px; background: var(--nk-surface); color: var(--nk-ink);
  font: inherit; font-size: 0.74rem; padding: 0.12rem 0.4rem;
}
.nk-time-input:focus { outline: none; border-color: var(--nk-brand); box-shadow: var(--esam-ring, 0 0 0 3px rgba(4, 84, 116, 0.16)); }

/* ── Compositor: botón de plantillas ── */
.nk-composer-row { display: flex; gap: 0.4rem; }
.nk-composer-row .nk-composer-collapsed { flex: 1; }
.nk-template-btn {
  flex: 0 0 auto; width: 40px; border-radius: 10px; cursor: pointer;
  border: 1px dashed color-mix(in srgb, var(--nk-brand) 40%, var(--nk-line));
  background: var(--nk-surface); color: var(--nk-brand); font-size: 1rem;
}
.nk-template-btn:hover, .nk-template-btn[aria-expanded="true"] { border-color: var(--nk-brand); background: var(--nk-brand-soft); }
.nk-template-btn:focus-visible { outline: 2px solid var(--nk-brand); outline-offset: 2px; }
.nk-template-pick {
  margin-top: 0.5rem; padding: 0.6rem; border-radius: 12px;
  border: 1px solid var(--nk-brand); background: var(--nk-surface);
}
.nk-template-pick[hidden] { display: none; }
.nk-template-pick .nk-field-label:first-child { margin-top: 0; }
.nk-tpl-steps { margin: 0.55rem 0 0; padding-left: 1.1rem; font-size: 0.78rem; color: var(--nk-ink); }
.nk-tpl-steps li + li { margin-top: 0.2rem; }
.nk-tpl-when { color: var(--nk-mute); font-size: 0.7rem; white-space: nowrap; }
.nk-tpl-pin { color: var(--nk-pin); margin-right: 0.2rem; font-size: 0.75rem; }
.nk-template-pick .nk-composer-foot { justify-content: flex-end; }

/* ── Ficha: datos de otras líneas ── */
.person-fill:not(:empty) {
  margin: 0 1rem 0.6rem; padding: 0.45rem 0.6rem; border-radius: 10px;
  background: var(--ib-surface-2, #f6f8fb); border: 1px solid var(--ib-line, #e6ebf1);
}
.pf-row { display: flex; align-items: baseline; gap: 0.4rem; font-size: 0.76rem; line-height: 1.5; flex-wrap: wrap; }
.pf-label { color: var(--ib-ink-mute, #98a2b3); min-width: 4.6rem; }
.pf-value { color: var(--ib-ink, #101828); font-weight: 600; overflow-wrap: anywhere; }
.pf-src { font-size: 0.66rem; color: var(--ib-brand, #045474); }
.person-lines[hidden] { display: none; }
.pl-row {
  display: flex; align-items: center; gap: 0.55rem; padding: 0.45rem 0.55rem; border-radius: 10px;
  border: 1px solid var(--ib-line, #e6ebf1); background: var(--ib-surface, #fff);
}
.pl-row + .pl-row { margin-top: 0.4rem; }
.pl-row.waiting { border-color: color-mix(in srgb, var(--esam-warning, #b45309) 45%, var(--ib-line, #e6ebf1)); }
.pl-ic { color: #25a35a; font-size: 1.05rem; flex: 0 0 auto; }
.pl-body { flex: 1; min-width: 0; }
.pl-line { font-size: 0.8rem; font-weight: 600; color: var(--ib-ink, #101828); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-phone { font-weight: 500; color: var(--ib-ink-mute, #98a2b3); font-variant-numeric: tabular-nums; }
.pl-meta { font-size: 0.7rem; color: var(--ib-ink-soft, #475467); }
.pl-badge {
  flex: 0 0 auto; font-size: 0.64rem; font-weight: 700; padding: 0.08rem 0.45rem; border-radius: 999px;
  color: var(--esam-warning, #b45309); background: rgba(180, 83, 9, 0.1);
}
html[data-bs-theme="dark"] .pl-badge { color: #f3b25f; background: rgba(243, 178, 95, 0.13); }
.pl-hint { margin: 0.45rem 0 0; }

/* ── Recordatorios y resumen del día ── */
.rem-stack {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 2900;
  display: flex; flex-direction: column; gap: 0.6rem; width: min(360px, calc(100vw - 2rem));
}

/* Aviso de mensaje nuevo (tarjeta inferior derecha, estilo WhatsApp) */
.msg-stack { pointer-events: none; }
.msg-stack > * { pointer-events: auto; }
.msg-alert {
  display: flex;
  align-items: stretch;
  background: var(--ib-surface);
  color: var(--ib-ink);
  border: 1px solid var(--ib-line);
  border-left: 4px solid var(--ib-brand);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 40px -18px rgba(6, 32, 63, 0.5);
  animation: ma-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
html[data-bs-theme="dark"] .msg-alert { background: #152033; border-color: #24324a; }
.msg-alert .ma-open {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 0.55rem;
  border: 0; background: transparent; cursor: pointer; text-align: left;
  padding: 0.6rem 0.3rem 0.6rem 0.7rem;
  color: inherit; font: inherit;
}
.msg-alert .ma-open .avatar-sm { flex: 0 0 auto; }
.msg-alert .ma-body { display: flex; flex-direction: column; gap: 0.1rem; flex: 1; min-width: 0; }
.msg-alert .ma-head { display: flex; align-items: baseline; gap: 0.4rem; min-width: 0; }
.msg-alert .ma-name {
  flex: 1; min-width: 0;
  font-weight: 700; font-size: 0.82rem; color: var(--ib-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg-alert .ma-time { flex: 0 0 auto; font-size: 0.68rem; color: var(--ib-ink-mute); }
.msg-alert .ma-text {
  font-size: 0.78rem; color: var(--ib-ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg-alert .ma-ico { font-size: 1.5rem; line-height: 1; color: var(--ib-brand); }
.msg-alert .ma-x {
  flex: 0 0 auto; align-self: center;
  border: 0; background: transparent; color: var(--ib-ink-mute);
  cursor: pointer; font-size: 1rem; padding: 0.5rem 0.55rem; border-radius: 10px;
}
.msg-alert .ma-x:hover { color: var(--ib-ink); background: var(--ib-surface-3); }
.msg-alert.ma-burst { border-left-color: var(--ib-accent, #e6dd5e); }
@keyframes ma-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}
.rem-card {
  --rem: var(--ib-brand, #045474);
  background: var(--esam-surface, #fff); color: var(--esam-ink, #101828);
  border: 1px solid var(--esam-line, #e6ebf1); border-left: 4px solid var(--rem);
  border-radius: 14px; padding: 0.7rem 0.8rem; font-size: 0.82rem;
  box-shadow: 0 18px 40px -18px rgba(14, 26, 43, 0.35);
  animation: rem-in 0.22s var(--esam-ease, ease);
}
html[data-bs-theme="dark"] .rem-card { --rem: #6cc3e3; background: #152033; border-color: #24324a; color: #e6edf5; }
.rem-card.rem-day { --rem: var(--esam-warning, #b45309); }
html[data-bs-theme="dark"] .rem-card.rem-day { --rem: #f3b25f; }
.rem-head { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; color: var(--rem); }
.rem-x { margin-left: auto; border: 0; background: transparent; color: var(--esam-muted, #98a2b3); cursor: pointer; font-size: 1rem; line-height: 1; }
.rem-x:hover { color: inherit; }
.rem-x:focus-visible, .rem-snooze button:focus-visible, .rem-notify:focus-visible { outline: 2px solid var(--rem); outline-offset: 2px; }
.rem-text { margin: 0.35rem 0 0.25rem; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.rem-contact { display: flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; color: var(--esam-muted, #98a2b3); }
.rem-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-top: 0.55rem; }
.rem-snooze { display: inline-flex; align-items: center; gap: 0.2rem; flex-wrap: wrap; }
.rem-snooze button {
  border: 1px solid var(--esam-line, #e6ebf1); background: transparent; color: inherit;
  border-radius: 7px; font-size: 0.7rem; font-weight: 600; padding: 0.1rem 0.4rem; cursor: pointer;
}
.rem-snooze button:hover { border-color: var(--rem); color: var(--rem); }
.rem-notify {
  display: block; margin-top: 0.45rem; border: 0; background: transparent; padding: 0;
  font-size: 0.7rem; color: var(--rem); cursor: pointer; text-decoration: underline;
}
.rem-list { list-style: none; margin: 0.45rem 0 0; padding: 0; }
.rem-list li {
  display: grid; grid-template-columns: 4.2rem 1fr; column-gap: 0.4rem; font-size: 0.76rem;
  padding: 0.25rem 0; border-top: 1px solid var(--esam-line, #e6ebf1);
}
html[data-bs-theme="dark"] .rem-list li { border-color: #24324a; }
.rem-when { font-weight: 700; color: var(--rem); grid-row: span 2; }
.rem-list li.late .rem-when { color: var(--esam-danger, #bb3b3b); }
.rem-what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rem-who { font-size: 0.68rem; color: var(--esam-muted, #98a2b3); }
@keyframes rem-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rem-card { animation: none; } }

/* ── /notes: gestor de plantillas ── */
.np-templates { display: flex; flex-direction: column; gap: 0.45rem; }
.tpl-item {
  display: flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.55rem; border-radius: 10px;
  border: 1px solid var(--nk-line); background: var(--nk-surface);
}
.tpl-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tpl-item-main b { font-size: 0.82rem; color: var(--nk-ink); }
.tpl-item-main span { font-size: 0.7rem; color: var(--nk-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-steps { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.4rem; }
.tpl-step {
  display: grid; grid-template-columns: auto auto auto 1fr; gap: 0.3rem; align-items: center;
  padding: 0.4rem; border-radius: 9px; background: var(--nk-surface-2);
}
.tpl-step .tpl-text { grid-column: 1 / -1; }
.tpl-days { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.7rem; color: var(--nk-mute); margin: 0; }
.tpl-days-input { width: 3.6rem; }
.tpl-time { width: 6.4rem; }
.tpl-pin { display: inline-flex; align-items: center; margin: 0; color: var(--nk-pin); cursor: pointer; }
.tpl-del { justify-self: end; }
.tpl-foot { display: flex; gap: 0.35rem; justify-content: flex-end; margin-top: 0.6rem; }
.tpl-foot .tpl-remove { margin-right: auto; }

/* ══ Anti-Baneo ══════════════════════════════════════════════════════════════ */
.ab-page {
  --ab-brand: #045474;
  --ab-brand-soft: rgba(4, 84, 116, 0.09);
  --ab-ok: var(--esam-success, #0f7a52);
  --ab-ok-soft: rgba(15, 122, 82, 0.1);
  --ab-warn: var(--esam-warning, #b45309);
  --ab-warn-soft: rgba(180, 83, 9, 0.1);
  --ab-danger: var(--esam-danger, #bb3b3b);
  --ab-danger-soft: rgba(187, 59, 59, 0.1);
  --ab-info: var(--esam-info, #2b6cb0);
  --ab-info-soft: rgba(43, 108, 176, 0.1);
  --ab-mute: var(--esam-muted, #66768b);
  --ab-mute-soft: var(--esam-surface-3, #edf1f7);
  display: flex; flex-direction: column; gap: 1rem;
}
html[data-bs-theme="dark"] .ab-page {
  --ab-brand: #6cc3e3;
  --ab-brand-soft: rgba(108, 195, 227, 0.13);
  --ab-ok: #5fd3a6;
  --ab-ok-soft: rgba(95, 211, 166, 0.13);
  --ab-warn: #f3b25f;
  --ab-warn-soft: rgba(243, 178, 95, 0.13);
  --ab-danger: #f08484;
  --ab-danger-soft: rgba(240, 132, 132, 0.13);
  --ab-info: #7fb2ec;
  --ab-info-soft: rgba(127, 178, 236, 0.13);
}
.ab-page .card { margin-bottom: 0; }
.ab-page .ab-ok { --tone: var(--ab-ok); --tone-soft: var(--ab-ok-soft); }
.ab-page .ab-warn { --tone: var(--ab-warn); --tone-soft: var(--ab-warn-soft); }
.ab-page .ab-danger { --tone: var(--ab-danger); --tone-soft: var(--ab-danger-soft); }
.ab-page .ab-info { --tone: var(--ab-info); --tone-soft: var(--ab-info-soft); }
.ab-page .ab-mute { --tone: var(--ab-mute); --tone-soft: var(--ab-mute-soft); }
.ab-t-warn { color: var(--ab-warn); }
.ab-t-danger { color: var(--ab-danger); }
.ab-mono { font-variant-numeric: tabular-nums; font-family: var(--bs-font-monospace, monospace); font-size: 0.82rem; }

/* Indicadores */
.ab-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.75rem; }
.ab-kpi {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; min-width: 0;
  background: var(--esam-surface); border: 1px solid var(--esam-line); border-radius: var(--esam-radius, 14px);
  color: inherit; text-decoration: none; box-shadow: var(--esam-shadow-xs);
  transition: border-color 0.15s ease, transform 0.15s var(--esam-ease, ease), box-shadow 0.15s ease;
}
a.ab-kpi:hover { border-color: var(--esam-line-strong); transform: translateY(-1px); box-shadow: var(--esam-shadow-sm); color: inherit; }
a.ab-kpi:focus-visible { outline: 2px solid var(--ab-brand); outline-offset: 2px; }
.ab-kpi-ic {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; font-size: 1.15rem;
  display: inline-flex; align-items: center; justify-content: center; color: var(--tone); background: var(--tone-soft);
}
.ab-kpi-body { display: flex; flex-direction: column; min-width: 0; }
.ab-kpi-label { font-size: 0.72rem; font-weight: 600; color: var(--esam-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-kpi-value { font-size: 1.35rem; font-weight: 700; line-height: 1.15; color: var(--esam-ink); font-variant-numeric: tabular-nums; }
.ab-kpi-sub { font-size: 0.7rem; color: var(--esam-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-dotline { display: inline-flex; align-items: center; gap: 0.25rem; font-variant-numeric: tabular-nums; }
.ab-dotline .ab-dot + * { margin-right: 0.2rem; }
.ab-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tone, currentColor); flex: 0 0 auto; }

/* Pestañas */
.ab-tabs {
  display: flex; gap: 0.25rem; padding: 0.3rem; overflow-x: auto; scrollbar-width: thin;
  background: var(--esam-surface); border: 1px solid var(--esam-line); border-radius: 12px;
}
.ab-tab {
  display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap;
  padding: 0.45rem 0.9rem; border-radius: 9px; font-size: 0.84rem; font-weight: 600;
  color: var(--esam-ink-soft); text-decoration: none; transition: background 0.15s ease, color 0.15s ease;
}
.ab-tab:hover { background: var(--esam-surface-2); color: var(--esam-ink); }
.ab-tab.on { background: var(--ab-brand); color: #fff; }
html[data-bs-theme="dark"] .ab-tab.on { color: #06203f; }
.ab-tab:focus-visible { outline: 2px solid var(--ab-brand); outline-offset: 2px; }

/* Monitoreo: pestañas de vinculación y filtros por área */
.ab-monitor-filters { display: flex; flex-direction: column; gap: 0.65rem; }
.ab-monitor-tabs { width: 100%; }
.ab-monitor-tabs .ab-tab { padding: 0.38rem 0.75rem; font-size: 0.8rem; }
.ab-monitor-areas { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.ab-monitor-areas-label {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.69rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--esam-muted);
}
.ab-monitor-areas .ab-filters { flex: 1 1 260px; }

/* Píldoras y chips */
.ab-pill {
  display: inline-flex; align-items: center; gap: 0.3rem; white-space: nowrap;
  font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 999px;
  color: var(--tone, var(--ab-mute)); background: var(--tone-soft, var(--ab-mute-soft));
}
.ab-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ab-chip {
  display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; font-weight: 600;
  padding: 0.2rem 0.55rem; border-radius: 8px; border: 1px solid var(--esam-line);
  color: var(--tone, var(--esam-ink-soft)); background: var(--tone-soft, var(--esam-surface-2));
}
.ab-chip.ab-ok, .ab-chip.ab-warn, .ab-chip.ab-danger { border-color: transparent; }
.ab-note { display: flex; gap: 0.35rem; align-items: flex-start; font-size: 0.74rem; color: var(--tone); background: var(--tone-soft); padding: 0.35rem 0.55rem; border-radius: 8px; }

/* Monitoreo: tarjetas por línea */
.ab-sessions { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 1rem; }
.ab-session {
  display: flex; flex-direction: column; gap: 0.75rem; padding: 1rem 1.1rem;
  background: var(--esam-surface); border: 1px solid var(--esam-line); border-radius: var(--esam-radius-lg, 18px);
  box-shadow: var(--esam-shadow-xs); border-top: 3px solid var(--ab-ok);
}
.ab-session.ab-h-yellow { border-top-color: var(--ab-warn); }
.ab-session.ab-h-red, .ab-session.is-quarantine { border-top-color: var(--ab-danger); }
.ab-session-head { display: flex; align-items: center; gap: 0.7rem; }
.ab-session-ic {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto; font-size: 1.2rem;
  display: inline-flex; align-items: center; justify-content: center; color: #25a35a; background: rgba(37, 163, 90, 0.1);
}
.ab-session-id { min-width: 0; flex: 1; }
.ab-session-name { font-weight: 700; color: var(--esam-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-session-phone { font-size: 0.76rem; color: var(--esam-muted); font-variant-numeric: tabular-nums; }
.ab-session-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: flex-end; }
.ab-session-reason { margin: -0.25rem 0 0; font-size: 0.78rem; color: var(--esam-ink-soft); }
.ab-meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.ab-meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.3rem; font-size: 0.72rem; color: var(--esam-muted); margin-bottom: 0.3rem; }
.ab-meter-top b { color: var(--esam-ink); font-size: 0.88rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ab-meter-top small { color: var(--esam-muted); font-weight: 500; font-size: 0.7rem; }
.ab-meter-bar { height: 6px; border-radius: 999px; background: var(--esam-surface-3); overflow: hidden; }
.ab-meter-bar span { display: block; height: 100%; border-radius: inherit; background: var(--tone); transition: width 0.4s var(--esam-ease, ease); }
.ab-session-body { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 1rem; align-items: end; }
.ab-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.55rem 0.75rem; margin: 0; }
.ab-figures dt { font-size: 0.68rem; font-weight: 600; color: var(--esam-muted); white-space: nowrap; }
.ab-figures dd { margin: 0; font-size: 1rem; font-weight: 700; color: var(--esam-ink); font-variant-numeric: tabular-nums; }
.ab-mini-label { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--esam-muted); margin-bottom: 0.3rem; }
.ab-trend { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; height: 76px; }
.ab-trend-col { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.ab-trend-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.ab-trend-bar {
  position: relative; width: 100%; border-radius: 4px 4px 2px 2px; overflow: hidden;
  background: color-mix(in srgb, var(--ab-brand) 22%, transparent);
}
.ab-trend-bar span { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ab-brand); }
.ab-trend-flag { position: absolute; top: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--ab-danger); box-shadow: 0 0 0 2px var(--esam-surface); }
.ab-trend-day { font-size: 0.62rem; color: var(--esam-muted); text-transform: uppercase; }
.ab-trend-empty { height: 76px; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; color: var(--esam-muted); border: 1px dashed var(--esam-line); border-radius: 8px; text-align: center; padding: 0 0.5rem; }
.ab-session-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; padding-top: 0.75rem; border-top: 1px solid var(--esam-line); }
.ab-session-actions form { margin: 0; }

/* Línea todavía sin vincular: sin métricas ni acciones de envío. */
.ab-session.is-unlinked { border-top-color: var(--ab-mute); }
.ab-session.is-unlinked .ab-session-ic { color: var(--esam-muted); background: var(--esam-surface-3); }
.ab-unlinked-note {
  display: flex; align-items: flex-start; gap: 0.55rem;
  padding: 0.75rem 0.85rem; border-radius: 10px;
  background: var(--esam-surface-2); color: var(--esam-ink-soft); font-size: 0.8rem;
}
.ab-unlinked-note i { color: var(--esam-muted); font-size: 1rem; margin-top: 1px; }
.ab-unlinked-note p { margin: 0; }
.ab-session.is-unlinked .ab-session-actions { justify-content: space-between; }

/* Lotes en pausa */
.ab-panel { background: var(--esam-surface); border: 1px solid var(--esam-line); border-radius: var(--esam-radius, 14px); padding: 0.9rem 1rem; }
.ab-panel-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.ab-panel-head h6 { margin: 0; display: flex; align-items: center; gap: 0.4rem; font-weight: 700; }
.ab-panel-head h6 i { color: var(--ab-warn); }
.ab-count { font-size: 0.7rem; font-weight: 700; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--esam-surface-3); color: var(--esam-ink-soft); }
.ab-paused { list-style: none; margin: 0; padding: 0; }
.ab-paused li { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0; border-top: 1px solid var(--esam-line); }
.ab-paused li:first-child { border-top: 0; padding-top: 0; }
.ab-paused-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ab-paused-main a { font-weight: 700; color: var(--esam-ink); }
.ab-paused-meta { font-size: 0.72rem; color: var(--esam-muted); }
.ab-paused-reason { font-size: 0.78rem; color: var(--ab-warn); margin-top: 0.1rem; }

/* Políticas: estructura */
.ab-policy-layout, .ab-bl-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.ab-aside { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: calc(70px + 1rem); }
.ab-card .card-body { padding: 1.15rem 1.25rem; }
.ab-card-title { display: flex; flex-direction: column; margin-bottom: 0.9rem; }
.ab-card-title h5 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--esam-ink); }
.ab-card-title span { font-size: 0.78rem; color: var(--esam-muted); }
.ab-form-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; padding: 0.75rem 0.9rem; margin-bottom: 1rem;
  background: var(--esam-surface-2); border: 1px solid var(--esam-line); border-radius: 12px;
}
.ab-form-top .ab-switch { flex: 1 1 260px; }
.ab-form-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.ab-form-nav a {
  font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.55rem; border-radius: 7px;
  color: var(--esam-ink-soft); text-decoration: none; border: 1px solid var(--esam-line); background: var(--esam-surface);
}
.ab-form-nav a:hover { border-color: var(--ab-brand); color: var(--ab-brand); }
.ab-group { padding: 1.1rem 0; border-top: 1px solid var(--esam-line); scroll-margin-top: 90px; }
.ab-group:first-of-type { border-top: 0; padding-top: 0; }
.ab-group-head { display: flex; gap: 0.7rem; align-items: flex-start; margin-bottom: 0.85rem; }
.ab-group-ic {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ab-brand); background: var(--ab-brand-soft);
}
.ab-group-head h6 { margin: 0; font-size: 0.9rem; font-weight: 700; color: var(--esam-ink); }
.ab-group-head p { margin: 0.1rem 0 0; font-size: 0.76rem; color: var(--esam-muted); }
.ab-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem 1.1rem; }
.ab-span-2 { grid-column: 1 / -1; }
.ab-subgrid {
  display: grid; grid-template-columns: 1.3fr repeat(3, minmax(0, 1fr)); gap: 0.9rem; align-items: end;
  padding: 0.75rem; border-radius: 10px; background: var(--esam-surface-2);
}
.ab-field { min-width: 0; }
.ab-field .form-label { font-size: 0.78rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--esam-ink-soft); }
.ab-field .form-text, .ab-switch .form-text { font-size: 0.7rem; margin-top: 0.25rem; color: var(--esam-muted); }
.ab-switch { align-self: center; }
.ab-switch .form-check-label { font-size: 0.84rem; font-weight: 600; color: var(--esam-ink); }
.ab-days { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ab-day { margin: 0; cursor: pointer; }
.ab-day input { position: absolute; opacity: 0; pointer-events: none; }
.ab-day span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 48px; padding: 0.35rem 0.6rem;
  border-radius: 9px; border: 1px solid var(--esam-line); background: var(--esam-surface);
  font-size: 0.8rem; font-weight: 600; color: var(--esam-ink-soft);
  transition: border-color 150ms var(--esam-ease-out), background-color 150ms var(--esam-ease-out),
    color 150ms var(--esam-ease-out);
}
.ab-day input:checked + span { background: var(--ab-brand); border-color: var(--ab-brand); color: #fff; }
html[data-bs-theme="dark"] .ab-day input:checked + span { color: #06203f; }
.ab-day input:focus-visible + span { outline: 2px solid var(--ab-brand); outline-offset: 2px; }
.ab-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.ab-preset { margin: 0; cursor: pointer; }
.ab-preset input { position: absolute; opacity: 0; pointer-events: none; }
.ab-preset-body {
  display: flex; flex-direction: column; gap: 0.2rem; height: 100%; padding: 0.7rem 0.8rem; border-radius: 12px;
  border: 1px solid var(--esam-line); background: var(--esam-surface);
  transition: border-color 150ms var(--esam-ease-out), background-color 150ms var(--esam-ease-out);
}
.ab-preset:hover .ab-preset-body { border-color: var(--esam-line-strong); }
.ab-preset input:checked + .ab-preset-body { border-color: var(--ab-brand); background: var(--ab-brand-soft); box-shadow: 0 0 0 1px var(--ab-brand) inset; }
.ab-preset input:focus-visible + .ab-preset-body { outline: 2px solid var(--ab-brand); outline-offset: 2px; }
.ab-preset-title { display: flex; align-items: center; gap: 0.35rem; font-weight: 700; font-size: 0.86rem; color: var(--esam-ink); }
.ab-preset-title i { color: var(--ab-brand); }
.ab-preset-text { font-size: 0.72rem; color: var(--esam-muted); }
.ab-preset-figs { font-size: 0.68rem; font-weight: 600; color: var(--esam-ink-soft); font-variant-numeric: tabular-nums; margin-top: auto; padding-top: 0.25rem; }
.ab-savebar {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  margin: 0.5rem -1.25rem -1.15rem; padding: 0.75rem 1.25rem;
  background: color-mix(in srgb, var(--esam-surface) 92%, transparent); backdrop-filter: blur(6px);
  border-top: 1px solid var(--esam-line); border-radius: 0 0 var(--esam-radius, 14px) var(--esam-radius, 14px);
}
.ab-savebar-hint { flex: 1 1 200px; min-width: 0; display: inline-flex; gap: 0.35rem; align-items: center; font-size: 0.74rem; color: var(--esam-muted); }
.ab-savebar .btn { flex: 0 0 auto; white-space: nowrap; }
.ab-lines { display: flex; flex-direction: column; gap: 0.4rem; }
.ab-line {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.65rem; border-radius: 10px;
  border: 1px solid var(--esam-line); color: inherit; text-decoration: none; transition: border-color 0.15s ease, background 0.15s ease;
}
.ab-line:hover { border-color: var(--ab-brand); background: var(--ab-brand-soft); color: inherit; }
.ab-line-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ab-line-main b { font-size: 0.84rem; color: var(--esam-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-line-main span { font-size: 0.72rem; color: var(--esam-muted); }
.ab-line > i { color: var(--esam-muted); }
.ab-tips h6 { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; margin-bottom: 0.5rem; }
.ab-tips h6 i { color: var(--ab-warn); }
.ab-tips ul { margin: 0; padding-left: 1.05rem; font-size: 0.78rem; color: var(--esam-ink-soft); }
.ab-tips li + li { margin-top: 0.4rem; }
.ab-aside .ab-session { box-shadow: none; }
.ab-aside .ab-session-body { grid-template-columns: 1fr; }
.ab-aside .ab-meters { grid-template-columns: 1fr; gap: 0.55rem; }

/* Lista negra */
.ab-bl-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 0.9rem; }
.ab-search {
  display: flex; align-items: center; gap: 0.45rem; flex: 1 1 240px; margin: 0;
  border: 1px solid var(--esam-line); border-radius: 10px; padding: 0.4rem 0.7rem; background: var(--esam-surface);
}
.ab-search:focus-within { border-color: var(--ab-brand); box-shadow: var(--esam-ring); }
.ab-search i { color: var(--esam-muted); }
.ab-search input[type="search"] { border: 0; outline: none; background: transparent; width: 100%; font-size: 0.84rem; color: var(--esam-ink); }
.ab-filters { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.ab-filter {
  display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.76rem; font-weight: 600;
  padding: 0.3rem 0.65rem; border-radius: 8px; border: 1px solid var(--esam-line); color: var(--esam-ink-soft); text-decoration: none;
}
.ab-filter span { font-size: 0.68rem; padding: 0 0.35rem; border-radius: 999px; background: var(--esam-surface-3); }
.ab-filter:hover { border-color: var(--ab-brand); color: var(--ab-brand); }
.ab-filter.on { border-color: var(--ab-brand); background: var(--ab-brand-soft); color: var(--ab-brand); }
.ab-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--esam-muted); font-weight: 700; }
.ab-table td { font-size: 0.84rem; }
.ab-table form { margin: 0; }
.ab-stack { display: flex; flex-direction: column; gap: 0.7rem; }

/* Bitácora */
.ab-log { list-style: none; margin: 0; padding: 0; position: relative; }
.ab-log::before { content: ''; position: absolute; left: 17px; top: 8px; bottom: 8px; width: 2px; background: var(--esam-line); }
.ab-log-item { position: relative; display: flex; gap: 0.8rem; align-items: flex-start; padding: 0.55rem 0; }
.ab-log-ic {
  position: relative; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
  color: var(--tone); background: var(--esam-surface); border: 2px solid var(--tone-soft); box-shadow: 0 0 0 3px var(--esam-surface);
}
.ab-log-body { flex: 1; min-width: 0; padding-top: 0.35rem; }
.ab-log-title { font-size: 0.86rem; font-weight: 600; color: var(--esam-ink); }
.ab-log-detail { font-size: 0.78rem; color: var(--esam-ink-soft); margin-top: 0.1rem; overflow-wrap: anywhere; }
.ab-log-time { flex: 0 0 auto; font-size: 0.72rem; color: var(--esam-muted); padding-top: 0.45rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Adaptación */
@media (max-width: 1399.98px) {
  .ab-policy-layout, .ab-bl-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1199.98px) {
  .ab-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ab-policy-layout, .ab-bl-layout { grid-template-columns: 1fr; }
  .ab-aside { position: static; }
}
@media (max-width: 767.98px) {
  .ab-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ab-grid, .ab-presets { grid-template-columns: 1fr; }
  .ab-subgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ab-subgrid .ab-switch { grid-column: 1 / -1; }
  .ab-session-body { grid-template-columns: 1fr; }
  .ab-meters { grid-template-columns: 1fr; gap: 0.55rem; }
  .ab-savebar-hint { display: none; }
  .ab-log-time { display: none; }
}
@media (max-width: 575.98px) {
  /* Indicadores compactos en dos columnas: que las líneas queden a la vista. */
  .ab-kpis { gap: 0.5rem; }
  .ab-kpis > :first-child { grid-column: 1 / -1; }
  .ab-kpi { padding: 0.6rem 0.7rem; gap: 0.55rem; }
  .ab-kpi-ic { width: 32px; height: 32px; border-radius: 10px; font-size: 0.95rem; }
  .ab-kpi-value { font-size: 1.1rem; }
  .ab-kpi-sub { display: none; }
  .ab-kpis > :first-child .ab-kpi-sub { display: inline; }
}
@media (max-width: 479.98px) {
  .ab-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .ab-kpi, .ab-meter-bar span { transition: none; }
}

/* body { overflow-x: hidden } convierte al body en contenedor de scroll y anula
   position: sticky (barra de guardar, columna lateral). clip recorta igual sin romperlo. */
html:has(.ab-page), body:has(.ab-page) { overflow-x: clip; }

/* ══ Seguimiento, Reportes, Auditoría, Usuarios y Plantillas ═════════════════
   Reutilizan los componentes .ab-* (indicadores, pestañas, píldoras, tarjetas). */
.ab-kpis.ab-kpis-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.ab-kpis.adm-kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ab-tab-badge {
  min-width: 18px; padding: 0 0.35rem; border-radius: 999px; font-size: 0.66rem; font-weight: 700; text-align: center;
  background: var(--ab-danger-soft); color: var(--ab-danger);
}
.ab-tab.on .ab-tab-badge { background: rgba(255, 255, 255, 0.22); color: inherit; }
.ab-kpi-value .fu-delta { vertical-align: middle; }

/* Seguimiento y Reportes */
.fu-page .fu-toolbar { margin-bottom: 0; }
.fu-page .insight { margin: 0; }
.fu-tabs-row { display: flex; align-items: center; gap: 0.75rem; }
.fu-tabs-row .ab-tabs { flex: 1; min-width: 0; }
.fu-tabs-row .fu-updated { font-size: 0.72rem; color: var(--esam-muted); white-space: nowrap; }
.fu-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: stretch; }
.fu-split.fu-split-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fu-split > * { min-width: 0; }
.fu-delta { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 0.05rem 0.4rem; border-radius: 999px; color: var(--esam-muted); background: var(--esam-surface-3); white-space: nowrap; }
.fu-delta.is-good { color: var(--ab-ok); background: var(--ab-ok-soft); }
.fu-delta.is-bad { color: var(--ab-danger); background: var(--ab-danger-soft); }
.fu-delta.fu-delta-new { color: var(--ab-info); background: var(--ab-info-soft); }
.fu-compare { display: flex; align-items: center; gap: 0.35rem; margin: 0 0 -0.4rem; font-size: 0.74rem; color: var(--esam-muted); }
.fu-lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 1rem; }
.fu-line {
  display: flex; flex-direction: column; gap: 0.75rem; padding: 1rem 1.1rem;
  background: var(--esam-surface); border: 1px solid var(--esam-line); border-radius: var(--esam-radius-lg, 18px);
}
.fu-line header { display: flex; align-items: center; gap: 0.65rem; }
.fu-line footer { display: flex; gap: 0.4rem; padding-top: 0.7rem; border-top: 1px solid var(--esam-line); }
.fu-small { font-size: 0.82rem !important; font-weight: 600 !important; }
.fu-protect { display: flex; flex-direction: column; gap: 1rem; padding-top: 0.25rem; }
.fu-protect-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; }
.fu-protect-figs > div { display: flex; flex-direction: column; font-size: 0.74rem; color: var(--esam-muted); padding: 0.6rem 0.75rem; border-radius: 10px; background: var(--esam-surface-2); }
.fu-protect-figs span { font-size: 1.3rem; font-weight: 700; color: var(--esam-ink); font-variant-numeric: tabular-nums; }
.fu-protect-figs .ab-t-danger span { color: var(--ab-danger); }
.fu-protect-figs .ab-t-warn span { color: var(--ab-warn); }
.fu-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.fu-bars li { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 3rem; gap: 0.75rem; align-items: center; font-size: 0.8rem; }
.fu-bars-label { color: var(--esam-ink-soft); }
.fu-bars-track { height: 8px; border-radius: 999px; background: var(--esam-surface-3); overflow: hidden; }
.fu-bars-track span { display: block; height: 100%; border-radius: inherit; background: var(--ab-warn); }
.fu-bars b { text-align: right; font-variant-numeric: tabular-nums; color: var(--esam-ink); }

/* Auditoría */
.adm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; }
.adm-toolbar .ab-search { flex: 1 1 260px; }
.adm-date { display: flex; align-items: center; gap: 0.35rem; margin: 0; font-size: 0.74rem; color: var(--esam-muted); }
.adm-date input { width: auto; }
.adm-check { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; font-size: 0.78rem; color: var(--esam-ink-soft); }
.adm-cats { margin-bottom: 0.75rem; }
.adm-cats .ab-filter i { font-size: 0.85rem; }
.adm-log .adm-day {
  position: relative; padding: 0.75rem 0 0.35rem 3rem; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--esam-muted); background: var(--esam-surface);
}
.adm-log .adm-day:first-child { padding-top: 0; }
.adm-times { font-size: 0.7rem; font-weight: 700; padding: 0.02rem 0.4rem; border-radius: 999px; background: var(--esam-surface-3); color: var(--esam-ink-soft); }
.adm-kvs { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }
.adm-kv {
  display: inline-flex; align-items: baseline; gap: 0.3rem; max-width: 100%; font-size: 0.74rem; color: var(--esam-ink);
  padding: 0.1rem 0.5rem; border-radius: 7px; background: var(--esam-surface-2); border: 1px solid var(--esam-line); overflow-wrap: anywhere;
}
.adm-kv b { font-weight: 600; color: var(--esam-muted); font-size: 0.68rem; }
.adm-raw { margin-top: 0.3rem; font-size: 0.7rem; color: var(--esam-muted); }
.adm-raw summary { cursor: pointer; width: max-content; }
.adm-raw code { font-size: 0.68rem; overflow-wrap: anywhere; }
.adm-more { display: flex; justify-content: center; padding-top: 0.75rem; }

/* Usuarios */
.adm-sub { font-size: 0.7rem; color: var(--esam-muted); margin-top: 0.15rem; }
.adm-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.adm-users td { vertical-align: middle; }

/* Usuarios: tabla sin scroll horizontal que se adapta al ancho disponible. */
.adm-table-wrap { width: 100%; }
.adm-users { table-layout: fixed; width: 100%; }
.adm-users thead th { white-space: normal; overflow-wrap: normal; }
.adm-users td { overflow-wrap: anywhere; padding-left: 0.75rem; padding-right: 0.75rem; }
.adm-users .ab-pill { white-space: normal; overflow-wrap: normal; }
.adm-users th:nth-child(1) { width: 22%; }
.adm-users th:nth-child(2) { width: 12%; }
.adm-users th:nth-child(3) { width: 17%; }
.adm-users th:nth-child(4) { width: 11%; }
.adm-users th:nth-child(5) { width: 13%; }
.adm-users th:nth-child(6) { width: 13%; }
.adm-users th:nth-child(7) { width: 12%; }

/* 1200–1399 px: se omite «Última actividad» y el resto respira. */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  .adm-users th:nth-child(5), .adm-users td:nth-child(5) { display: none; }
  .adm-users th:nth-child(1) { width: 26%; }
  .adm-users th:nth-child(2) { width: 13%; }
  .adm-users th:nth-child(3) { width: 18%; }
  .adm-users th:nth-child(4) { width: 13%; }
  .adm-users th:nth-child(6) { width: 17%; }
  .adm-users th:nth-child(7) { width: 13%; }
}

/* Menos de 1200 px: cada fila pasa a ser una tarjeta con todas las etiquetas. */
@media (max-width: 1199.98px) {
  .adm-users { table-layout: auto; }
  .adm-users thead { display: none; }
  .adm-users,
  .adm-users tbody { display: block; width: 100%; }
  .adm-users tr {
    display: block; margin-bottom: 0.6rem; padding: 0.7rem 0.85rem;
    border: 1px solid var(--esam-line); border-radius: var(--esam-radius-sm);
    background: var(--esam-surface);
  }
  .adm-users tr:last-child { margin-bottom: 0; }
  .adm-users td,
  .adm-users td:nth-child(5),
  .adm-users td:nth-child(6) {
    --adm-label: 11rem;
    display: flex; flex-wrap: wrap; gap: 0 0.7rem; align-items: flex-start;
    padding: 0.3rem 0; border: 0; overflow-wrap: break-word;
  }
  .adm-users td::before {
    content: attr(data-label); flex: 0 0 var(--adm-label);
    font-size: 0.68rem; font-weight: 700; line-height: 1.6;
    text-transform: uppercase; letter-spacing: 0.05em; color: var(--esam-muted);
  }
  .adm-users td > .adm-sub {
    flex: 0 0 calc(100% - var(--adm-label));
    margin: 0.05rem 0 0 var(--adm-label);
  }
  .adm-users td:nth-child(1) { padding: 0 0 0.45rem; }
  .adm-users td:nth-child(1)::before { display: none; }
  .adm-users td > * { min-width: 0; }
  .table-hover > tbody > tr:hover > * { background: transparent; }
  .adm-users tr:hover { border-color: var(--esam-line-strong); }
}

/* Teléfono: la etiqueta va arriba del valor y el valor usa todo el ancho. */
@media (max-width: 575.98px) {
  .adm-users td,
  .adm-users td:nth-child(5),
  .adm-users td:nth-child(6) { display: block; }
  .adm-users td::before { display: block; margin-bottom: 0.1rem; }
  .adm-users td > .adm-sub { margin: 0.1rem 0 0; }
}
.adm-foot { display: flex; gap: 0.4rem; align-items: flex-start; margin: 0.9rem 0 0; font-size: 0.74rem; color: var(--esam-muted); }
.adm-foot i { margin-top: 0.1rem; }
.adm-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }

/* Plantillas */
.tpl-layout { grid-template-columns: minmax(0, 1fr) 440px; }
.tpl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 0.9rem; }
.tpl-card {
  display: flex; flex-direction: column; gap: 0.6rem; padding: 0.9rem 1rem; border-radius: 14px;
  border: 1px solid var(--esam-line); background: var(--esam-surface); transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tpl-card:hover { border-color: var(--esam-line-strong); box-shadow: var(--esam-shadow-sm); }
.tpl-card.is-off { background: var(--esam-surface-2); }
.tpl-card.is-off .tpl-bubble { opacity: 0.65; }
.tpl-card.is-editing { border-color: var(--ab-brand); box-shadow: 0 0 0 1px var(--ab-brand) inset; }
.tpl-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; }
.tpl-card-edit { flex: 0 0 auto; padding: 0.28rem 0.5rem; }
.tpl-card-name { font-weight: 700; color: var(--esam-ink); }
.tpl-id { font-size: 0.7rem; font-weight: 600; color: var(--esam-muted); font-variant-numeric: tabular-nums; }
.tpl-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin-top: 0.25rem; }
.tpl-card-meta .adm-sub { margin: 0 0 0 0.2rem; }
.tpl-bubble {
  position: relative; padding: 0.55rem 0.7rem; border-radius: 10px 10px 10px 2px; font-size: 0.8rem; line-height: 1.45;
  background: #e7f6dc; color: #111b21; white-space: normal; overflow-wrap: anywhere; max-height: 12rem; overflow: auto;
}
html[data-bs-theme="dark"] .tpl-bubble { background: #144d37; color: #e9edef; }
.tpl-var { display: inline-block; padding: 0 0.3rem; border-radius: 5px; font-size: 0.74rem; font-weight: 600; font-family: var(--bs-font-monospace, monospace); background: rgba(4, 84, 116, 0.12); color: #045474; }
html[data-bs-theme="dark"] .tpl-var { background: rgba(108, 195, 227, 0.2); color: #9fdcf2; }
.tpl-var::before { content: '{{ '; opacity: 0.55; }
.tpl-var::after { content: ' }}'; opacity: 0.55; }
.tpl-spin { padding: 0 0.25rem; border-radius: 5px; background: rgba(217, 140, 0, 0.16); color: #7a4a00; }
html[data-bs-theme="dark"] .tpl-spin { background: rgba(245, 194, 91, 0.2); color: #f5d38f; }
.tpl-spin i { font-style: normal; opacity: 0.5; margin: 0 0.15rem; }
.tpl-card-info { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; font-size: 0.72rem; color: var(--esam-muted); }
.tpl-card-info span { display: inline-flex; align-items: center; gap: 0.25rem; }
.tpl-card-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: auto; padding-top: 0.6rem; border-top: 1px solid var(--esam-line); }
.tpl-card-actions form { margin: 0; }
.tpl-body { font-family: var(--bs-font-monospace, monospace); font-size: 0.82rem; line-height: 1.5; }
.tpl-help { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; margin-top: 0.35rem; font-size: 0.7rem; color: var(--esam-muted); }
.tpl-help code { font-size: 0.7rem; }
.tpl-preview-wrap { display: flex; flex-direction: column; gap: 0.45rem; }
.tpl-count { float: right; text-transform: none; letter-spacing: 0; font-weight: 600; }
.tpl-phone { padding: 0.75rem; border-radius: 12px; background: #efeae2; }
html[data-bs-theme="dark"] .tpl-phone { background: #0b141a; }
.tpl-phone .tpl-bubble { max-height: 18rem; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08); }
.tpl-vars { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tpl-vars:empty { display: none; }
.tpl-spin-hint[hidden] { display: none; }

/* Adaptación */
@media (max-width: 1599.98px) { .ab-kpis.ab-kpis-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1399.98px) { .tpl-layout { grid-template-columns: minmax(0, 1fr) 380px; } }
@media (max-width: 1199.98px) {
  .fu-split, .fu-split.fu-split-even { grid-template-columns: 1fr; }
  .tpl-layout { grid-template-columns: 1fr; }
}
@media (max-width: 767.98px) {
  .ab-kpis.ab-kpis-6, .ab-kpis.adm-kpis-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fu-protect-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fu-bars li { grid-template-columns: 1fr 2.5rem; }
  .fu-bars-track { grid-column: 1 / -1; grid-row: 2; }
  .fu-tabs-row { flex-wrap: wrap; }
  .adm-grid-2 { grid-template-columns: 1fr; }
}

.fu-mini { font-size: 0.66rem; padding: 0.05rem 0.4rem; margin-top: 0.2rem; }
.fu-pending .fu-last { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; max-width: 30ch; }

/* ══ Usuarios: última actividad y ficha individual ══════════════════════════ */
.adm-user-link { color: inherit; text-decoration: none; border-bottom: 1px dotted transparent; }
.adm-user-link:hover { color: var(--ab-brand); border-bottom-color: currentColor; }
.adm-use { display: inline-flex; align-items: center; gap: 0.28rem; font-weight: 600; color: var(--esam-ink); }
.adm-use i { color: var(--ab-brand); font-size: 0.9rem; }

.team-person { display: flex; align-items: center; gap: 0.55rem; min-width: 210px; }
.team-link { color: var(--esam-ink); font-weight: 700; text-decoration: none; }
.team-link:hover { color: var(--ab-brand); text-decoration: underline; }
.team-link.is-muted { color: var(--esam-muted); font-weight: 600; }
.team-link.is-muted:hover { color: var(--esam-muted); text-decoration: none; }
.team-metric { font-variant-numeric: tabular-nums; }
.team-muted { color: var(--esam-muted); font-variant-numeric: tabular-nums; }
.team-phone {
  display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center;
  color: var(--ab-brand); background: var(--ab-brand-soft); flex: 0 0 auto;
}
.team-open { white-space: nowrap; }
.team-open i { font-size: 0.82rem; }
.team-table td { vertical-align: middle; }
.team-table th:last-child, .team-table td:last-child { text-align: right; }
.team-table .ab-pill i { margin-right: 0.15rem; }

/* Bootstrap `.card` es flex-column: forzamos fila para la cabecera horizontal. */
.ur-hero {
  display: flex; flex-direction: row; align-items: stretch; gap: 1.5rem; padding: 1.3rem 1.4rem;
  background:
    radial-gradient(circle at 100% 0, rgba(4, 84, 116, 0.09), transparent 42%),
    var(--esam-surface);
}
.ur-hero-main { display: flex; align-items: center; gap: 1.1rem; min-width: 0; flex: 1 1 auto; }
.ur-avatar { flex: 0 0 auto; font-size: 1.15rem; }
.ur-identity { min-width: 0; }
.ur-name { font-size: 1.45rem; line-height: 1.18; font-weight: 700; color: var(--esam-ink); margin: 0 0 0.25rem; letter-spacing: -0.01em; }
.ur-meta { font-size: 0.78rem; color: var(--esam-muted); overflow-wrap: anywhere; }
.ur-chips { display: flex; flex-wrap: wrap; gap: 0.32rem; margin-top: 0.65rem; }
.ur-chip {
  display: inline-flex; align-items: center; gap: 0.28rem; max-width: 100%;
  padding: 0.18rem 0.55rem; border-radius: 999px; border: 1px solid var(--esam-line);
  background: var(--esam-surface-2); color: var(--esam-ink-soft); font-size: 0.72rem; font-weight: 600;
  overflow-wrap: anywhere;
}
.ur-chip .badge { padding: 0; background: transparent !important; font-size: inherit; }
.ur-chip .badge .badge-dot { display: none; }
.ur-chip.is-ok { color: var(--fu-ok); border-color: transparent; background: var(--fu-ok-soft); }
.ur-chip.is-danger { color: var(--fu-late); border-color: transparent; background: var(--fu-late-soft); }
.ur-chip.is-muted { color: var(--esam-muted); }
.ur-hero-side {
  display: grid; grid-template-columns: 1fr; gap: 0.7rem;
  flex: 0 1 330px; padding-left: 1.4rem; border-left: 1px solid var(--esam-line); align-content: center;
}
.ur-fact { display: flex; flex-direction: column; gap: 0.12rem; min-width: 0; }
.ur-fact-label {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--esam-muted);
}
.ur-fact-label i { font-size: 0.86rem; color: var(--ab-brand); }
.ur-fact b { font-size: 1.02rem; line-height: 1.25; color: var(--esam-ink); }
.ur-fact small { font-size: 0.7rem; line-height: 1.35; color: var(--esam-muted); overflow-wrap: anywhere; }

.ur-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.85rem; }
.ur-kpis .ab-kpi-sub { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; }
.ur-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 1.1rem; align-items: stretch; }
.ur-layout > * { min-width: 0; }
.ur-chart { min-height: 300px; }
.ur-task-counts { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.15rem 0 0.75rem; }
.ur-task-counts span {
  font-size: 0.7rem; font-weight: 700; padding: 0.16rem 0.55rem; border-radius: 999px;
  color: var(--esam-ink-soft); background: var(--esam-surface-2);
}
.ur-task-counts .is-late { color: var(--fu-late); background: var(--fu-late-soft); }
.ur-tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.ur-task { display: flex; gap: 0.55rem; align-items: flex-start; }
.ur-task-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; margin-top: 0.38rem; background: var(--esam-muted); }
.ur-task.is-late .ur-task-dot { background: var(--fu-late); }
.ur-task.is-today .ur-task-dot { background: var(--fu-warn); }
.ur-task.is-pending .ur-task-dot { background: var(--fu-brand); }
.ur-task-main { min-width: 0; }
.ur-task-text { display: block; font-size: 0.8rem; font-weight: 600; color: var(--esam-ink); text-decoration: none; overflow-wrap: anywhere; }
.ur-task-text:hover { color: var(--ab-brand); text-decoration: underline; }
.ur-task-meta { display: flex; flex-wrap: wrap; gap: 0.15rem 0.55rem; margin-top: 0.12rem; font-size: 0.68rem; color: var(--esam-muted); }
.ur-task-meta a { color: var(--esam-ink-soft); text-decoration: none; }
.ur-task-meta a:hover { color: var(--ab-brand); text-decoration: underline; }

.ur-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ur-act { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.55rem 0; border-bottom: 1px solid var(--esam-line); }
.ur-act:last-child { border-bottom: 0; padding-bottom: 0; }
.ur-act-ico {
  display: inline-flex; width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  align-items: center; justify-content: center; color: var(--ab-brand); background: var(--ab-brand-soft);
}
.ur-act.is-note .ur-act-ico { color: var(--fu-warn); background: var(--fu-warn-soft); }
.ur-act-main { flex: 1; min-width: 0; }
.ur-act-main a, .ur-act-main > span { display: block; font-size: 0.8rem; font-weight: 600; color: var(--esam-ink); text-decoration: none; overflow-wrap: anywhere; }
.ur-act-main a:hover { color: var(--ab-brand); text-decoration: underline; }
.ur-act-main p { margin: 0.1rem 0 0; font-size: 0.72rem; color: var(--esam-muted); overflow-wrap: anywhere; }
.ur-act-time { flex: 0 0 auto; font-size: 0.68rem; color: var(--esam-muted); white-space: nowrap; padding-top: 0.15rem; }

@media (max-width: 1199.98px) {
  .ur-layout { grid-template-columns: 1fr; }
  .ur-hero { flex-direction: column; }
  .ur-hero-side {
    flex: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem 1.35rem;
    padding-left: 0; padding-top: 1.1rem; border-left: 0; border-top: 1px solid var(--esam-line);
  }
}
@media (max-width: 991.98px) {
  .ur-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
  .ur-hero { padding: 1.1rem 1.05rem; }
  .ur-hero-main { align-items: flex-start; }
  .ur-name { font-size: 1.2rem; }
  .ur-hero-side { grid-template-columns: 1fr; gap: 0.9rem; }
  .team-person { min-width: 170px; }
  .team-open { font-size: 0.7rem; }
}
@media (max-width: 575.98px) {
  .ur-hero { padding: 1rem 0.95rem; }
  .ur-kpis { grid-template-columns: 1fr; }
}

/* ══ Notificaciones (campana) ════════════════════════════════════════════════ */
.notif-wrap { margin-left: 0.25rem; }
.notif-wrap #notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #d92d20; color: #fff; font-size: 0.66rem; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--esam-surface, #fff);
}
.notif-badge[hidden] { display: none; }
.notif-menu { width: min(380px, calc(100vw - 1.5rem)); border-radius: 14px; overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--esam-line, #e3e8f1); }
.notif-head b { font-size: 0.88rem; color: var(--esam-ink, #0e1a2b); }
.notif-readall { border: 0; background: transparent; padding: 0; font-size: 0.72rem; font-weight: 600; color: var(--ib-brand, #045474); cursor: pointer; }
.notif-readall:hover { text-decoration: underline; }
.notif-tabs {
  display: flex; gap: 0.3rem; padding: 0.5rem 0.7rem; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--esam-line, #e3e8f1);
}
.notif-tabs::-webkit-scrollbar { display: none; }
.notif-tab {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 0.3rem;
  border: 0; border-radius: 999px; padding: 0.28rem 0.55rem;
  background: var(--esam-surface-2, #f2f5fa); color: var(--esam-muted, #66768b);
  font-size: 0.71rem; font-weight: 600; line-height: 1.2; cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.notif-tab:hover, .notif-tab:focus-visible { color: var(--esam-ink, #0e1a2b); outline: none; }
.notif-tab.active { background: var(--ib-brand, #045474); color: #fff; }
.notif-tab-count {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: color-mix(in srgb, var(--ib-brand, #045474) 14%, transparent);
  color: inherit; font-size: 0.62rem; font-weight: 700; line-height: 16px; text-align: center;
}
.notif-tab.active .notif-tab-count { background: rgba(255, 255, 255, 0.24); }
.notif-tab-count[hidden] { display: none; }
.notif-list { max-height: min(70vh, 420px); overflow-y: auto; }
.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 1.4rem 1rem; font-size: 0.8rem; color: var(--esam-muted, #66768b); }
.notif-empty span { font-size: 1.5rem; opacity: 0.5; }
.notif-item {
  display: flex; gap: 0.65rem; width: 100%; padding: 0.65rem 0.9rem; border: 0; border-bottom: 1px solid var(--esam-line, #e3e8f1);
  background: transparent; text-align: left; cursor: pointer; color: inherit;
}
.notif-item:hover, .notif-item:focus-visible { background: var(--esam-surface-2, #f7f9fc); outline: none; }
.notif-item.unread { background: color-mix(in srgb, var(--ib-brand, #045474) 6%, transparent); }
.notif-item.unread .notif-title::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 0.35rem; vertical-align: middle;
  background: var(--ib-brand, #045474);
}
.notif-ic {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ib-brand, #045474); background: color-mix(in srgb, var(--ib-brand, #045474) 10%, transparent);
}
.notif-item.k-derived_to_you .notif-ic { color: #fff; background: var(--ib-brand, #045474); }
.notif-item.k-contacted .notif-ic, .notif-item.k-resolved .notif-ic { color: var(--esam-success, #0f7a52); background: rgba(15, 122, 82, 0.1); }
/* Línea caída: se ve como alerta, no como aviso común. */
.notif-item.k-session_down .notif-ic { color: #fff; background: var(--esam-danger, #bb3b3b); }
.notif-item.k-session_down.unread { background: color-mix(in srgb, var(--esam-danger, #bb3b3b) 8%, transparent); }
.notif-item.k-session_down.unread .notif-title::before { background: var(--esam-danger, #bb3b3b); }
.notif-body { display: flex; flex-direction: column; min-width: 0; }
.notif-title { font-size: 0.8rem; font-weight: 600; color: var(--esam-ink, #0e1a2b); line-height: 1.35; }
.notif-text { font-size: 0.74rem; color: var(--esam-ink-soft, #3b4a5e); margin-top: 0.1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-time { font-size: 0.68rem; color: var(--esam-muted, #66768b); margin-top: 0.15rem; }
.notif-foot { padding: 0.45rem 0.7rem; border-top: 1px solid var(--esam-line, #e3e8f1); }
.notif-history-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.74rem; font-weight: 600; color: var(--ib-brand, #045474); text-decoration: none;
}
.notif-history-link:hover { text-decoration: underline; }

/* ══ Historial de notificaciones ════════════════════════════════════════════ */
.nh-toolbar {
  display: flex; flex-wrap: wrap; gap: 0.7rem 1.2rem;
  align-items: center; justify-content: space-between; margin-bottom: 1rem;
}
.nh-list .nh-item { padding: 0.7rem 0; }
.nh-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-left: 0.15rem; vertical-align: middle; background: var(--ib-brand, #045474);
}
.nh-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.75rem;
  margin-top: 0.4rem; font-size: 0.72rem; color: var(--esam-muted, #66768b);
}
.nh-tag {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.14rem 0.45rem;
  border-radius: 999px; background: var(--tone-soft); color: var(--tone); font-weight: 600;
}
.nh-tag i { font-size: 0.82rem; }
.nh-actor { display: inline-flex; align-items: center; gap: 0.25rem; }
.nh-state { padding: 0.1rem 0.4rem; border-radius: 999px; font-weight: 600; }
.nh-state.is-unread { background: color-mix(in srgb, var(--ib-brand, #045474) 12%, transparent); color: var(--ib-brand, #045474); }
.nh-state.is-read { background: var(--esam-surface-3, #edf1f7); color: var(--esam-muted, #66768b); }
.nh-link {
  display: inline-flex; align-items: center; gap: 0.2rem;
  font-weight: 600; color: var(--ib-brand, #045474); text-decoration: none;
}
.nh-link:hover { text-decoration: underline; }
.nh-pager {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid var(--esam-line, #e3e8f1);
  font-size: 0.78rem; color: var(--esam-muted, #66768b);
}
.nh-pager .disabled { pointer-events: none; opacity: 0.45; }
.nh-count {
  margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--esam-line, #e3e8f1);
  font-size: 0.75rem; color: var(--esam-muted, #66768b);
}
@media (max-width: 575.98px) {
  .nh-toolbar { flex-direction: column; align-items: flex-start; }
  .nh-pager { justify-content: center; }
}

/* ══ Derivación en la tarjeta de la nota ═════════════════════════════════════ */
.nk-deriv {
  margin-top: 0.55rem; padding: 0.55rem 0.65rem; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--nk-brand) 25%, var(--nk-line)); background: color-mix(in srgb, var(--nk-brand) 4%, var(--nk-surface));
}
.nk-deriv.is-mine { border-color: var(--nk-brand); box-shadow: 0 0 0 1px var(--nk-brand) inset; }
.nk-deriv-head { display: flex; align-items: flex-start; gap: 0.35rem; font-size: 0.76rem; color: var(--nk-ink-soft); }
.nk-deriv-head > span:first-child { color: var(--nk-brand); margin-top: 0.1rem; }
.nk-deriv-head b { color: var(--nk-ink); font-weight: 600; }
.nk-steps { list-style: none; margin: 0.45rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.nk-step {
  display: flex; align-items: flex-start; gap: 0.3rem; padding: 0.25rem 0.5rem; border-radius: 8px; font-size: 0.72rem;
  background: var(--nk-surface); border: 1px solid var(--nk-line); color: var(--nk-ink-soft); max-width: 100%;
}
.nk-step > span { margin-top: 0.1rem; }
.nk-step div { display: flex; flex-direction: column; min-width: 0; }
.nk-step b { font-weight: 700; }
.nk-step.is-ok { border-color: color-mix(in srgb, var(--nk-ok) 35%, var(--nk-line)); }
.nk-step.is-ok > span, .nk-step.is-ok b { color: var(--nk-ok); }
.nk-step.is-wait > span, .nk-step.is-wait b { color: var(--nk-warn); }
.nk-step q { display: block; margin-top: 0.15rem; font-style: italic; color: var(--nk-ink); overflow-wrap: anywhere; }
.nk-deriv-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.55rem; }
.nk-contact-form { margin-top: 0.5rem; }
.nk-contact-form[hidden] { display: none; }
.nk-contact-form .nk-editor-foot { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.45rem; }
.nk-contact-form .nk-editor-foot .nk-hint { margin-right: auto; }

/* /notes: nota de un aviso y resumen de derivaciones */
.np-stats { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.np-focus, .np-deriv-sum {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.9rem; padding: 0.55rem 0.75rem;
  border-radius: 10px; font-size: 0.8rem; background: var(--nk-brand-soft); color: var(--nk-brand);
}
.np-focus .np-clear { margin-left: auto; }
.np-deriv-sum { background: var(--nk-surface-2); color: var(--nk-ink-soft); gap: 0.5rem 1.25rem; }
.np-deriv-sum span { display: inline-flex; align-items: baseline; gap: 0.35rem; }
.np-deriv-sum b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.np-deriv-sum .is-wait b { color: var(--nk-warn); }
.np-deriv-sum .is-warn b { color: var(--nk-danger); }
.np-deriv-sum .is-ok b { color: var(--nk-ok); }
.np-group-d_unseen .np-group-title { color: var(--nk-warn); }
.np-group-d_nocontact .np-group-title { color: var(--nk-danger); }
.np-group-d_contacted .np-group-title { color: var(--nk-ok); }
@media (max-width: 1399.98px) { .np-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 767.98px) { .np-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ══ Programa y nombre completo (cronogramas) en el chat ═════════════════════ */
.convo .convo-prog {
  display: flex; align-items: center; gap: 0.25rem; min-width: 0; margin-bottom: 1px;
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--ib-brand, #045474); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.convo .convo-prog b { font-weight: 700; opacity: 0.7; }
.chat-header .chat-programa {
  display: inline-block; max-width: 22rem; margin-left: 0.45rem; padding: 0.05rem 0.5rem; vertical-align: middle;
  border-radius: 999px; font-size: 0.66rem; font-weight: 700; line-height: 1.5;
  color: var(--ib-brand, #045474); background: color-mix(in srgb, var(--ib-brand, #045474) 11%, transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-header .chat-waname { font-size: 0.72rem; color: var(--ib-ink-mute, #98a2b3); }
.contact-panel .contact-waname { font-size: 0.72rem; color: var(--ib-ink-mute, #98a2b3); margin-top: 0.1rem; }
.pf-progs .pf-value { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.pf-prog {
  padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600;
  color: var(--ib-brand, #045474); background: color-mix(in srgb, var(--ib-brand, #045474) 10%, transparent);
}
@media (max-width: 767.98px) { .chat-header .chat-programa { display: none; } }

/* Orden: programa · nombre completo · número de WhatsApp */
.convo .convo-number {
  display: flex; align-items: center; gap: 0.2rem; margin-top: 1px;
  font-size: 0.7rem; color: var(--ib-ink-soft, #475467); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.convo .convo-number [class^="ri-"] { color: #25a35a; font-size: 0.75rem; }
.chat-header .chat-progs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.1rem; min-width: 0; }
.chat-header .chat-progs .chat-programa { margin-left: 0; }
.chat-header .chat-id .sub .font-monospace { font-variant-numeric: tabular-nums; }
.contact-panel .contact-progs { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem; margin: 0.5rem 0 0.15rem; }
@media (max-width: 767.98px) { .chat-header .chat-progs .chat-programa { display: inline-block; max-width: 60vw; } }

/* Foto de perfil sobre las iniciales (si no carga, quedan las iniciales) */
.has-photo { position: relative; overflow: hidden; }
.has-photo > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; background: var(--esam-surface, #fff); }

/* Nombre registrado a mano en la ficha */
.contact-panel .contact-name-edit { border: 0; background: none; padding: 0 0.15rem; color: var(--ib-ink-mute, #98a2b3); font-size: 0.85rem; line-height: 1; vertical-align: middle; cursor: pointer; }
.contact-panel .contact-name-edit:hover { color: var(--ib-ink, #1f2937); }
.contact-panel .contact-namesrc { font-size: 0.7rem; color: var(--ib-ink-mute, #98a2b3); margin-top: 0.1rem; }
.contact-panel .contact-name-add { margin-top: 0.4rem; }
.contact-panel .contact-name-form { width: 100%; max-width: 260px; margin: 0.5rem auto 0; text-align: left; }
.contact-panel .contact-name-form small { display: block; margin-top: 0.3rem; font-size: 0.7rem; line-height: 1.3; }
.contact-panel .contact-name-actions { display: flex; gap: 0.35rem; margin-top: 0.4rem; align-items: center; }

/* Equipo: compañeros del sistema (nombre y área en lugar del nombre de WhatsApp) */
.convo .convo-team {
  display: flex; align-items: center; gap: 0.25rem; min-width: 0; margin-bottom: 1px;
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em;
  color: #0e9f6e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-header .chat-team {
  display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.05rem 0.5rem; border-radius: 999px;
  font-size: 0.66rem; font-weight: 700; line-height: 1.5; color: #0e9f6e;
  background: color-mix(in srgb, #0e9f6e 12%, transparent); margin-right: 0.3rem;
}
.contact-panel .contact-team {
  display: inline-flex; align-items: center; gap: 0.25rem; margin-top: 0.55rem; padding: 0.1rem 0.6rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; color: #0e9f6e; background: color-mix(in srgb, #0e9f6e 12%, transparent);
}
.convo .team-online { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #0e9f6e; margin-left: 0.25rem; }
.convo .team-start { color: var(--ib-brand, #045474); font-weight: 600; }
/* Tres pestañas (Números · Grupos · Equipo): solo el contador de no leídos,
   que nunca se corta; la etiqueta se acorta si falta espacio. */
.cl-tabs { display: flex; gap: 0.3rem; padding-left: 0.6rem; padding-right: 0.6rem; }
/* Cada pestaña toma el ancho de su texto + contador y reparte el sobrante. */
.cl-tab { flex: 1 1 auto; min-width: 0; padding: 0.42rem 0.4rem; gap: 0.25rem; font-size: 0.78rem; white-space: nowrap; overflow: hidden; }
.cl-tab .cl-tab-ic { flex-shrink: 0; font-size: 0.9rem; }
.cl-tab .cl-tab-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cl-tab-count { flex-shrink: 0; min-width: 1.2rem; padding: 0 0.32rem; font-size: 0.66rem; line-height: 1.15rem; text-align: center; }
.cl-tab-count[hidden] { display: none !important; }
.cl-tab.has-unread .cl-tab-count { background: #e53935; color: #fff; }
.cl-tab.active.has-unread .cl-tab-count { background: #fff; color: #c62828; }
/* Fila de conversación: nombre y número a todo el ancho; hora e indicadores a la derecha */
.convo { gap: 0.6rem; }
.convo .convo-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo .convo-number { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.convo .convo-side { flex-shrink: 0; align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 0.25rem; padding: 0.1rem 0; min-width: 2.2rem; }
.convo .convo-side .convo-time { font-size: 0.66rem; white-space: nowrap; }
.convo.unread .convo-side .convo-time { color: #1f9d55; font-weight: 700; }
.convo .convo-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; }
.convo .convo-badges .unread-pill { min-width: 20px; height: 20px; padding: 0 0.35rem; font-size: 0.66rem; }
@media (max-width: 991.98px) {
  .convo { padding: 0.6rem 0.65rem; }
  .convo .convo-name { font-size: 0.92rem; }
  .convo .convo-number { font-size: 0.74rem; }
  .convo .convo-last { font-size: 0.8rem; }
}
/* Lista angosta (portátil chico): sin íconos para dar lugar al texto */
@media (min-width: 992px) and (max-width: 1399.98px) { .cl-tab .cl-tab-ic { display: none; } }
/* Celular angosto: texto + contador sin ícono */
@media (max-width: 399.98px) { .cl-tab .cl-tab-ic { display: none; } .cl-tab { justify-content: center; padding-inline: 0.3rem; } }
/* Celular: el nombre largo usa hasta dos líneas en vez de cortarse */
@media (max-width: 575.98px) {
  .convo .convo-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; word-break: break-word; }
}

/* Notas: selector Lista / Pipeline (control segmentado) */
.np-view { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--nk-line); border-radius: 11px; background: var(--nk-surface-2); flex-shrink: 0; }
.np-view-btn {
  border: 0; background: transparent; color: var(--nk-ink-soft); cursor: pointer;
  font-size: 0.78rem; font-weight: 600; padding: 0.3rem 0.72rem; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 0.3rem;
  transition: background-color 0.16s var(--esam-ease), color 0.16s var(--esam-ease), box-shadow 0.16s var(--esam-ease);
}
.np-view-btn:hover { color: var(--nk-ink); background: color-mix(in srgb, var(--nk-brand) 8%, transparent); }
.np-view-btn.on { background: var(--nk-surface); color: var(--nk-brand); box-shadow: var(--esam-shadow-xs); }
.np-view-btn:focus-visible { outline: 2px solid var(--nk-brand); outline-offset: 1px; }

/* Pipeline de seguimiento */
.np-board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 0.8rem; align-items: stretch; overflow-x: auto; padding-bottom: 0.5rem; }
@media (max-width: 991.98px) {
  .np-board { grid-template-columns: repeat(4, minmax(250px, 80vw)); scroll-snap-type: x proximity; }
  .pl-col { scroll-snap-align: start; }
}
.pl-col {
  --stage: var(--nk-brand);
  position: relative; display: flex; flex-direction: column;
  background: var(--nk-surface-2); border: 1px solid var(--nk-line); border-radius: 16px;
  padding: 0.6rem 0.6rem 0.65rem; min-height: 240px;
  transition: border-color 0.18s var(--esam-ease), box-shadow 0.18s var(--esam-ease), background-color 0.18s ease;
}
/* Cintillo de color por etapa */
.pl-col::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, var(--stage), color-mix(in srgb, var(--stage) 25%, transparent) 65%, transparent);
}
.pl-col-todo { --stage: #64748b; }
.pl-col-doing { --stage: #2563eb; }
.pl-col-contacted { --stage: #d97706; }
.pl-col-done { --stage: #0e9f6e; }
html[data-bs-theme="dark"] .pl-col-todo { --stage: #94a3b8; }
html[data-bs-theme="dark"] .pl-col-doing { --stage: #60a5fa; }
html[data-bs-theme="dark"] .pl-col-contacted { --stage: #fbbf24; }
html[data-bs-theme="dark"] .pl-col-done { --stage: #34d399; }

/* Columna destino: resaltado cuando hay una tarjeta encima */
.pl-col.over,
.pl-col:has(.pl-ghost) {
  border-color: color-mix(in srgb, var(--stage) 55%, var(--nk-line));
  background: color-mix(in srgb, var(--stage) 8%, var(--nk-surface-2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--stage) 14%, transparent);
}
.pl-col-head { display: flex; align-items: center; gap: 0.45rem; font-weight: 700; font-size: 0.85rem; color: var(--nk-ink); padding-top: 0.35rem; }
.pl-col-ic {
  width: 26px; height: 26px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.95rem; background: color-mix(in srgb, var(--stage) 16%, transparent); color: var(--stage);
}
.pl-col-count {
  margin-left: auto; min-width: 1.5rem; text-align: center; font-size: 0.7rem; font-weight: 700;
  padding: 0.06rem 0.45rem; border-radius: 999px; background: var(--nk-surface); border: 1px solid var(--nk-line);
  color: var(--nk-ink-soft); font-variant-numeric: tabular-nums;
}
.pl-col-hint { font-size: 0.68rem; color: var(--nk-mute); margin: 0.3rem 0 0.55rem; line-height: 1.35; }
.pl-col-body { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; min-height: 64px; }
.pl-empty {
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
  border: 1px dashed var(--nk-line); border-radius: 12px; padding: 1.1rem 0.6rem;
  text-align: center; font-size: 0.72rem; color: var(--nk-mute);
  background: color-mix(in srgb, var(--nk-surface) 70%, transparent);
  transition: border-color 0.16s ease, background-color 0.16s ease;
}
.pl-empty span { font-size: 1.3rem; opacity: 0.55; }
.pl-empty b { font-weight: 600; color: var(--nk-ink-soft); }
.pl-col.over .pl-empty, .pl-col:has(.pl-ghost) .pl-empty {
  border-color: color-mix(in srgb, var(--stage) 45%, var(--nk-line));
  background: color-mix(in srgb, var(--stage) 8%, transparent);
}

/* Tarjeta del pipeline */
.pl-card {
  position: relative; background: var(--nk-surface); border: 1px solid var(--nk-line); border-radius: 12px;
  padding: 0.6rem 0.65rem; color: var(--nk-ink); box-shadow: var(--esam-shadow-xs); cursor: grab;
  transition: border-color 0.16s var(--esam-ease), box-shadow 0.2s var(--esam-ease), transform 0.16s var(--esam-ease), opacity 0.16s ease;
}
.pl-card:hover { border-color: color-mix(in srgb, var(--stage, var(--nk-brand)) 35%, var(--nk-line)); box-shadow: var(--esam-shadow-sm); transform: translateY(-1px); }
.pl-card:focus-visible { outline: 2px solid var(--nk-brand); outline-offset: 2px; }
.pl-card a, .pl-card button { cursor: pointer; }
.pl-card[draggable="true"] { cursor: grab; }
.pl-card.is-locked { cursor: default; background: var(--nk-surface-2); border-style: dashed; }
.pl-card.is-locked:hover { transform: none; box-shadow: none; }
.pl-card.dragging { opacity: 0.45; }
.pl-card.is-overdue { border-left: 3px solid var(--nk-danger); }
.pl-card.is-pinned { box-shadow: inset 0 0 0 1px color-mix(in srgb, #f59e0b 45%, transparent); }

/* Arrastre (SortableJS): copia flotante, hueco de destino y estado elegido */
.pl-card.pl-chosen { border-color: color-mix(in srgb, var(--stage, var(--nk-brand)) 45%, var(--nk-line)); box-shadow: var(--esam-shadow-sm); }
.pl-card.pl-ghost {
  opacity: 0.5; border-style: dashed; transform: none; box-shadow: none;
  border-color: color-mix(in srgb, var(--stage, var(--nk-brand)) 55%, var(--nk-line));
  background: color-mix(in srgb, var(--stage, var(--nk-brand)) 8%, var(--nk-surface));
}
.pl-fallback,
.pl-card.pl-fallback {
  position: absolute; z-index: 1300; margin: 0; pointer-events: none; cursor: grabbing; opacity: 0.97;
  background: var(--nk-surface); border: 1px solid color-mix(in srgb, var(--nk-brand) 45%, var(--nk-line));
  border-radius: 12px; box-shadow: var(--esam-shadow-lg, var(--esam-shadow, 0 12px 28px -14px rgba(14, 26, 43, 0.24)));
  transition: none;
}
body.pl-dragging-on { cursor: grabbing; user-select: none; }
body.pl-dragging-on .pl-card, body.pl-dragging-on .pl-col { cursor: grabbing; }

.pl-top { display: flex; align-items: center; gap: 0.35rem; }
.pl-tools { display: inline-flex; align-items: center; gap: 0.3rem; margin-left: auto; flex: 0 0 auto; }
/* Indicador de agarre: aparece al pasar el cursor */
.pl-grip { color: var(--nk-mute); font-size: 0.95rem; line-height: 1; opacity: 0; transition: opacity 0.15s ease; }
.pl-card:hover .pl-grip, .pl-card:focus-within .pl-grip, .pl-card.pl-chosen .pl-grip { opacity: 0.8; }
.pl-card.is-locked .pl-grip { display: none; }
.pl-contact { font-weight: 700; font-size: 0.82rem; color: var(--nk-ink); text-decoration: none; display: inline-flex; align-items: center; gap: 0.25rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-contact:hover { color: var(--nk-brand); }
.pl-contact .ri-whatsapp-line { color: #0e9f6e; }
.pl-pin { color: var(--nk-pin, #d97706); font-size: 0.85rem; }
.pl-text { font-size: 0.79rem; margin-top: 0.35rem; color: var(--nk-ink-soft); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pl-result {
  font-size: 0.74rem; margin-top: 0.35rem; padding: 0.3rem 0.45rem; border-radius: 8px; line-height: 1.4;
  background: color-mix(in srgb, var(--nk-warn) 10%, transparent); color: var(--nk-ink);
  border-left: 2px solid color-mix(in srgb, var(--nk-warn) 55%, transparent);
}
.pl-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.4rem; }
.pl-tag {
  font-size: 0.64rem; font-weight: 700; padding: 0.08rem 0.45rem; border-radius: 999px; line-height: 1.4;
  color: var(--tag); background: color-mix(in srgb, var(--tag) 14%, transparent);
}
.pl-foot {
  display: flex; flex-wrap: wrap; gap: 0.3rem 0.6rem; margin-top: 0.45rem; padding-top: 0.4rem;
  border-top: 1px dashed var(--nk-line); font-size: 0.7rem; color: var(--nk-mute); align-items: center;
}
.pl-foot span { display: inline-flex; align-items: center; gap: 0.22rem; }
.pl-due-overdue { color: var(--nk-danger); font-weight: 700; }
.pl-due-today { color: var(--nk-warn); font-weight: 700; }
.pl-due-done { color: var(--nk-mute); }
.pl-move { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; }
.pl-mv {
  border: 1px solid var(--nk-line); background: var(--nk-surface-2); color: var(--nk-ink-soft); border-radius: 8px;
  font-size: 0.7rem; font-weight: 600; padding: 0.14rem 0.5rem; display: inline-flex; align-items: center; gap: 0.15rem;
  transition: border-color 0.14s var(--esam-ease), color 0.14s var(--esam-ease), background-color 0.14s var(--esam-ease);
}
.pl-mv:hover { border-color: var(--nk-brand); color: var(--nk-brand); background: var(--nk-brand-soft); }
.pl-mv:focus-visible { outline: 2px solid var(--nk-brand); outline-offset: 2px; }
.pl-mv-next { border-color: color-mix(in srgb, var(--nk-brand) 45%, var(--nk-line)); color: var(--nk-brand); background: var(--nk-brand-soft); }

/* Aviso «¿Cómo fue la comunicación?». Se monta en <body> (fuera de
   .notes-page), así que sus colores salen de los tokens globales --esam-*
   (viven en :root y en el modo oscuro), nunca de --nk- ni --ib-, que solo
   existen dentro de su página: con esos el panel quedaba sin fondo. */
.pl-dialog-backdrop {
  position: fixed; inset: 0; z-index: 1080;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: pl-fade 0.16s var(--esam-ease);
}
html[data-bs-theme="dark"] .pl-dialog-backdrop { background: rgba(2, 6, 14, 0.66); }
.pl-dialog {
  background: var(--esam-surface); color: var(--esam-ink);
  border: 1px solid var(--esam-line);
  border-radius: 16px; padding: 1.1rem 1.15rem; width: 100%; max-width: 420px;
  box-shadow: var(--esam-shadow-lg);
  animation: pl-pop 0.18s var(--esam-ease);
}
@keyframes pl-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pl-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.pl-dialog h6 { font-weight: 800; margin: 0; display: flex; align-items: center; gap: 0.4rem; font-size: 0.95rem; color: var(--esam-ink); }
.pl-dialog h6 .ri-phone-line { color: var(--brand); }
html[data-bs-theme="dark"] .pl-dialog h6 .ri-phone-line { color: var(--brand-300); }
.pl-dialog-sub { font-size: 0.78rem; color: var(--esam-muted); margin: 0.25rem 0 0.6rem; }
.pl-dialog textarea {
  border-radius: 10px; font-size: 0.85rem;
  background: var(--esam-surface-2); color: var(--esam-ink); border-color: var(--esam-line-strong);
}
.pl-dialog textarea::placeholder { color: var(--esam-muted); }
.pl-dialog textarea:focus { background: var(--esam-surface); border-color: var(--brand); box-shadow: var(--esam-ring); }
html[data-bs-theme="dark"] .pl-dialog textarea { border-color: var(--esam-line-strong); }
html[data-bs-theme="dark"] .pl-dialog textarea:focus { border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(79, 179, 214, 0.2); }
.pl-dialog-actions { display: flex; justify-content: flex-end; gap: 0.4rem; margin-top: 0.7rem; }

/* Respeto por quien prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
  .np-stat, .np-view-btn, .np-tag, .np-cards .nk-card, .pl-card, .pl-col, .pl-empty, .pl-dialog {
    transition: none !important; animation: none !important;
  }
  .np-stat:hover, .np-stat.on, .np-cards .nk-card:hover, .pl-card:hover { transform: none !important; }
}

/* Notas: áreas (filtro de lista y pipeline) */
.np-areas { display: flex; gap: 0.4rem; overflow-x: auto; padding: 0.15rem 0 0.6rem; margin-bottom: 0.4rem; scrollbar-width: thin; }
.np-area {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.38rem 0.75rem;
  border: 1px solid var(--nk-line, #e6ebf1); border-radius: 999px; background: var(--nk-surface, #fff);
  color: var(--esam-ink, #1f2937); font-size: 0.8rem; font-weight: 600;
  transition: border-color 150ms var(--esam-ease-out), color 150ms var(--esam-ease-out);
}
.np-area:hover { border-color: var(--area); color: var(--area); }
.np-area .np-area-ic { color: var(--area); font-size: 0.95rem; }
.np-area .np-area-n { min-width: 1.4rem; padding: 0 0.4rem; border-radius: 999px; font-size: 0.7rem; text-align: center; background: color-mix(in srgb, var(--area) 12%, transparent); color: var(--area); }
.np-area.on { background: var(--area); border-color: var(--area); color: #fff; box-shadow: 0 6px 14px -8px var(--area); }
.np-area.on .np-area-ic { color: #fff; }
.np-area.on .np-area-n { background: rgba(255, 255, 255, 0.25); color: #fff; }
.np-area-badge {
  display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.05rem 0.5rem; border-radius: 999px;
  font-size: 0.66rem; font-weight: 700; color: var(--area); background: color-mix(in srgb, var(--area) 12%, transparent); white-space: nowrap;
}
.nk-contact .np-area-badge { margin-left: auto; }
.pl-area-row { margin-top: 0.35rem; }
html[data-bs-theme="dark"] .np-area { background: #1d2125; border-color: #2a2f34; color: #ced4da; }

/* Pipeline: columnas con desplazamiento vertical propio cuando hay muchas notas */
.notes-page .np-board { align-items: stretch; }
.notes-page .pl-col { max-height: calc(100dvh - 250px); min-height: 260px; }
.notes-page .pl-col-body { overflow-y: auto; min-height: 0; padding-right: 0.2rem; margin-right: -0.2rem; scrollbar-width: thin; overscroll-behavior: contain; }
.notes-page .pl-col-body::-webkit-scrollbar { width: 6px; }
.notes-page .pl-col-body::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.35); border-radius: 6px; }
.notes-page .pl-col-head { position: sticky; top: 0; }

/* Lotes: línea que envía y quién lo pidió */
.batch-who { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.45rem 0.6rem; border-radius: 10px; background: var(--vz-light, #f6f8fb); }
.batch-line { font-size: 0.78rem; display: flex; align-items: center; gap: 0.3rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch-line i { color: #25a35a; }
.batch-line .ri-user-line { color: var(--vz-primary, #045474); }
html[data-bs-theme="dark"] .batch-who { background: rgba(255, 255, 255, 0.05); }

/* Foto de quien escribe en un grupo */
.bubble-row.in .bubble-avatar { align-self: flex-end; flex-shrink: 0; margin-right: 0.4rem; cursor: pointer; }
.bubble-row.in .bubble-avatar .avatar-xs { width: 28px; height: 28px; font-size: 0.62rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }

/* Diagnóstico de la conexión */
.diag-card .card-body { display: flex; flex-direction: column; gap: 0.6rem; }
.diag-item { display: flex; gap: 0.7rem; padding: 0.7rem 0.8rem; border-radius: 12px; border: 1px solid var(--ib-line); background: var(--ib-surface-2); color: var(--ib-ink); }
.diag-item .diag-ico { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.diag-item.is-ok .diag-ico { background: color-mix(in srgb, #0e9f6e 14%, transparent); color: #0e9f6e; }
.diag-item.is-warn { border-color: color-mix(in srgb, #f59e0b 40%, var(--ib-line)); }
.diag-item.is-warn .diag-ico { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #b45309; }
.diag-item.is-danger { border-color: color-mix(in srgb, #dc3545 40%, var(--ib-line)); background: color-mix(in srgb, #dc3545 6%, var(--ib-surface-2)); }
.diag-item.is-danger .diag-ico { background: color-mix(in srgb, #dc3545 15%, transparent); color: #dc3545; }
.diag-title { font-weight: 700; font-size: 0.86rem; }
.diag-code { font-size: 0.68rem; font-weight: 600; color: var(--ib-ink-mute, #98a2b3); margin-left: 0.25rem; }
.diag-text { font-size: 0.8rem; color: var(--ib-ink-soft, #475467); margin-top: 0.15rem; }
.diag-action { font-size: 0.8rem; margin-top: 0.35rem; }
.diag-action code, .diag-text code { font-size: 0.72rem; word-break: break-all; }
.diag-ab { border: 1px dashed var(--ib-line); border-radius: 12px; padding: 0.65rem 0.8rem; }
.diag-ab-title { font-weight: 700; font-size: 0.8rem; margin-bottom: 0.4rem; color: var(--ib-ink); }
.diag-ab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.35rem 0.8rem; }
.diag-ab-grid div { display: flex; flex-direction: column; font-size: 0.78rem; }
.diag-ab-grid span { color: var(--ib-ink-mute, #98a2b3); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; }
.diag-ab-grid b { color: var(--ib-ink); }
.diag-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 0.2rem; }
.diag-tools small { display: block; margin-top: 0.3rem; font-size: 0.7rem; line-height: 1.3; color: var(--ib-ink-mute, #98a2b3); }
@media (max-width: 575.98px) { .diag-tools { grid-template-columns: 1fr; } }
.qr-reason { text-align: left; max-width: 460px; margin: 0.8rem auto 0; padding: 0.8rem 0.9rem; border-radius: 12px; border: 1px solid color-mix(in srgb, #f59e0b 45%, var(--ib-line)); background: color-mix(in srgb, #f59e0b 7%, var(--ib-surface)); color: var(--ib-ink); }
.qr-reason-title { font-weight: 700; font-size: 0.88rem; }
.qr-reason-text, .qr-reason-action { font-size: 0.8rem; margin-top: 0.3rem; }
.qr-reason-wait { font-size: 0.74rem; color: var(--ib-ink-mute, #98a2b3); margin-top: 0.5rem; }

/* =============================================================================
   Conversaciones · diseño adaptable (escritorio, portátil, tablet y celular)
   ============================================================================= */
.inbox { height: calc(100dvh - 190px); min-height: 480px; }
.inbox .tl-mob { display: none; }
.contact-panel .contact-close { display: none; }

/* Pantallas anchas: columnas más holgadas */
@media (min-width: 1400px) {
  .inbox { grid-template-columns: 340px minmax(0, 1fr) 340px; }
  .inbox.contact-hidden { grid-template-columns: 340px minmax(0, 1fr); }
}
/* Portátil: columnas un poco más angostas */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  .inbox { grid-template-columns: 300px minmax(0, 1fr) 300px; }
  .inbox.contact-hidden { grid-template-columns: 300px minmax(0, 1fr); }
  .inbox.list-hidden { grid-template-columns: 64px minmax(0, 1fr) 300px; }
}

/* Tablet horizontal / portátil chico: la ficha se abre como panel encima del chat */
@media (max-width: 1199.98px) {
  .inbox { position: relative; }
  .inbox,
  .inbox.contact-hidden { grid-template-columns: 300px minmax(0, 1fr); }
  .inbox.list-hidden,
  .inbox.list-hidden.contact-hidden { grid-template-columns: 64px minmax(0, 1fr); }
  .inbox .contact-panel {
    /* Sin columna propia: se mide contra todo el inbox (con grid-column 3 medía 0 px). */
    grid-column: auto !important; grid-row: auto;
    position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 92%); z-index: 30;
    display: block !important; overflow-y: auto;
    box-shadow: -18px 0 40px -18px rgba(6, 32, 63, 0.45);
    transform: translateX(0); transition: transform 0.22s ease, visibility 0.22s;
  }
  .inbox.contact-hidden .contact-panel { transform: translateX(105%); visibility: hidden; }
  .inbox:not(.contact-hidden).has-chat::after {
    content: ''; position: absolute; inset: 0; z-index: 25; background: rgba(15, 23, 42, 0.28);
  }
  .contact-panel .contact-close {
    display: inline-flex; position: sticky; top: 0.5rem; float: right; margin: 0.5rem 0.5rem 0 0; z-index: 2;
    width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--ib-line); background: var(--ib-surface);
    color: var(--ib-ink); align-items: center; justify-content: center; font-size: 1.1rem;
  }
}

/* Celular y tablet vertical: lista y chat de a uno, con «volver» */
@media (max-width: 991.98px) {
  .inbox,
  .inbox.contact-hidden,
  .inbox.list-hidden,
  .inbox.list-hidden.contact-hidden { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 150px); min-height: 460px; }
  .inbox .list-rail { display: none !important; }
  .inbox .chatlist { display: flex !important; grid-column: 1; grid-row: 1; max-height: none; min-height: 0; }
  .inbox .chat-col { display: none; grid-column: 1; grid-row: 1; min-height: 0; }
  .inbox.has-chat .chatlist { display: none !important; }
  .inbox.has-chat .chat-col { display: flex; }
  .inbox .contact-panel { width: 100%; box-shadow: none; }
  .inbox .tl-desk { display: none; }
  .inbox .tl-mob { display: inline; }
  .chat-card { min-height: 0; }
  .bubble-wrap { max-width: 86%; }
  .chat-header { padding: 0.55rem 0.65rem; gap: 0.5rem; }
  .chat-header .chat-id .name { font-size: 0.92rem; }
  .chat-header .chat-progs { display: none; }
  .composer { padding: 0.5rem 0.55rem calc(0.6rem + env(safe-area-inset-bottom, 0px)); }
  .composer-row { gap: 0.3rem; }
  #btn-quick, #btn-emoji { display: none; }
  .bubble-actions { display: none; }
  .bubble-row:active .bubble-actions { display: flex; }
}
@media (max-width: 991.98px) {
  /* El título de la página ocupa alto valioso: el chat usa toda la pantalla. */
  .page-content:has(.inbox) .page-title-box { display: none; }
  .inbox,
  .inbox.contact-hidden,
  .inbox.list-hidden,
  .inbox.list-hidden.contact-hidden { height: calc(100dvh - 104px); }
  .inbox .cl-title { flex-wrap: wrap; }
  .inbox .chatlist-head select { max-width: 100%; min-width: 0; }
  .inbox .chatlist-head { padding-bottom: 0.4rem; }
}
@media (max-width: 575.98px) {
  .inbox { border-radius: 12px; }
  .chat-header .chat-actions #sync-history { padding: 0.3rem 0.45rem; }
  .bubble { font-size: 0.88rem; }
}

/* Número oculto por WhatsApp (@lid) */
.convo .convo-number.is-hidden { color: var(--ib-ink-mute); font-style: italic; }
.contact-panel .contact-hidden-hint { font-size: 0.72rem; color: var(--ib-ink-mute); margin-top: 0.25rem; max-width: 260px; margin-inline: auto; }

/* Citas: a quién se responde */
.quote .quote-title { display: flex; align-items: center; gap: 0.25rem; font-size: 0.7rem; color: var(--ib-ink-soft); }
.quote .quote-title .quote-author { font-weight: 700; color: var(--ib-brand); }
.quote.quote-mine { border-left-color: #0e9f6e; }
.quote.quote-mine .quote-author { color: #0e9f6e; }
.composer .reply-preview .rp-title { font-weight: 700; }

/* PDF con vista previa */
.pdf-card { width: 260px; max-width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid var(--ib-line); background: var(--ib-surface); margin-bottom: 0.25rem; }
.pdf-card .pdf-thumb { display: flex; align-items: center; justify-content: center; height: 180px; background: var(--ib-surface-3); overflow: hidden; position: relative; }
.pdf-card .pdf-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.pdf-card .pdf-thumb.failed { color: #dc3545; font-size: 2.6rem; }
.pdf-card .pdf-thumb:hover img { opacity: 0.92; }
.pdf-card .pdf-loading { color: var(--ib-ink-mute); }
.pdf-card .pdf-foot { display: flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.55rem; border-top: 1px solid var(--ib-line); }
.pdf-card .pdf-ic { color: #dc3545; font-size: 1.35rem; flex-shrink: 0; }
.pdf-card .pdf-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; text-decoration: none; color: var(--ib-ink); }
.pdf-card .pdf-meta .nm { font-size: 0.78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdf-card .pdf-meta .doc-sub { font-size: 0.68rem; color: var(--ib-ink-mute); }
.pdf-card .doc-download { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--ib-ink-soft); background: var(--ib-surface-2); }
@media (max-width: 575.98px) { .pdf-card { width: 220px; } .pdf-card .pdf-thumb { height: 150px; } }

/* Notas: el pipeline usa todo el ancho y no se mete bajo las etiquetas */
.np-main { min-width: 0; }
.notes-page.board-mode .np-layout { grid-template-columns: minmax(0, 1fr); }
.notes-page.board-mode .np-side { display: none; }
.notes-page.board-mode .np-board { grid-template-columns: repeat(4, minmax(240px, 1fr)); }
@media (max-width: 1199.98px) { .notes-page.board-mode .np-board { grid-template-columns: repeat(4, minmax(250px, 300px)); } }
.np-board { scroll-snap-type: x proximity; }
.np-board .pl-col { scroll-snap-align: start; }

/* -- Mensajes fijados (aviso interno del equipo) -- */
#chat-pinned { flex-shrink: 0; }
.pinned-bar { background: var(--ib-surface); border-bottom: 1px solid var(--ib-line); }
.pinned-summary {
  width: 100%; display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 1rem; border: 0; background: transparent;
  text-align: left; cursor: pointer;
}
.pinned-ic { color: var(--ib-brand); font-size: 1rem; flex-shrink: 0; }
.pinned-summary-text { min-width: 0; flex: 1; display: flex; align-items: baseline; gap: 0.55rem; }
.pinned-title {
  font-size: 0.64rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.055em; color: var(--ib-brand); white-space: nowrap;
}
.pinned-preview { min-width: 0; font-size: 0.75rem; color: var(--ib-ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinned-chevron { color: var(--ib-ink-mute); flex-shrink: 0; transition: transform 0.15s ease; }
.pinned-bar.open .pinned-chevron { transform: rotate(180deg); }
.pinned-list { display: none; padding: 0 0.65rem 0.45rem; }
.pinned-bar.open .pinned-list { display: block; }
.pinned-item { display: flex; align-items: stretch; gap: 0.25rem; border-top: 1px solid var(--ib-line); }
.pinned-jump {
  flex: 1; min-width: 0; border: 0; background: transparent; text-align: left;
  padding: 0.42rem 0.35rem; cursor: pointer; border-radius: 8px;
}
.pinned-jump:hover { background: var(--ib-brand-soft); }
.pinned-item-top { display: flex; align-items: center; gap: 0.4rem; font-size: 0.62rem; color: var(--ib-ink-mute); }
.pinned-item-time { margin-left: auto; flex-shrink: 0; }
.pinned-item-body { display: block; font-size: 0.76rem; color: var(--ib-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinned-unpin {
  flex-shrink: 0; border: 0; background: transparent; color: var(--ib-ink-mute);
  cursor: pointer; padding: 0 0.35rem; border-radius: 8px;
}
.pinned-unpin:hover { color: #dc3545; background: rgba(220, 53, 69, 0.08); }
html[data-bs-theme="dark"] .pinned-bar { background: #111a26; }
.bubble-actions .act-pin.is-pinned { color: var(--ib-brand); }

/* -- Tarjetas de contacto compartido -- */
.wa-contact-list { display: flex; flex-direction: column; gap: 0.4rem; min-width: 230px; max-width: 100%; }
.wa-contact-card {
  display: flex; align-items: center; gap: 0.55rem; min-width: 0;
  padding: 0.5rem; border: 1px solid var(--ib-line); border-radius: 12px;
  background: var(--ib-surface); color: var(--ib-ink);
}
.wa-contact-card.is-clickable { cursor: pointer; }
.wa-contact-card.is-clickable:hover { border-color: var(--ib-brand); box-shadow: 0 6px 18px -12px rgba(6, 32, 63, 0.55); }
.wa-contact-avatar { flex-shrink: 0; display: inline-flex; }
.wa-contact-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.wa-contact-name { font-size: 0.84rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-contact-phone { display: flex; align-items: center; gap: 0.25rem; font-size: 0.69rem; color: var(--ib-ink-mute); white-space: nowrap; }
.wa-contact-phone .ri-whatsapp-line { color: #25d366; }
.wa-contact-phone.is-missing { font-style: italic; }
.wa-contact-open {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.3rem;
  border: 0; border-radius: 9px; padding: 0.4rem 0.55rem;
  background: var(--ib-brand-soft); color: var(--ib-brand);
  font-size: 0.7rem; font-weight: 700; cursor: pointer;
}
.wa-contact-open:hover { filter: brightness(0.96); }
html[data-bs-theme="dark"] .wa-contact-card { background: #16202d; border-color: rgba(120, 190, 220, 0.18); }

/* -- Encuestas -- */
.wa-poll { min-width: 250px; max-width: 340px; }
.wa-poll-head {
  display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.62rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ib-ink-mute);
}
.wa-poll-head .ri-bar-chart-horizontal-line { color: var(--ib-brand); font-size: 0.9rem; }
.wa-poll-question { margin: 0.22rem 0 0.55rem; font-size: 0.92rem; font-weight: 700; line-height: 1.3; color: var(--ib-ink); }
.wa-poll-options { display: flex; flex-direction: column; gap: 0.3rem; }
.wa-poll-option {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.6rem; border: 1px solid var(--ib-line); border-radius: 10px;
  background: var(--ib-surface); color: var(--ib-ink); font-size: 0.8rem;
}
.wa-poll-mark {
  flex-shrink: 0; width: 15px; height: 15px; border: 1.5px solid var(--ib-ink-mute);
  border-radius: 50%; background: transparent;
}
.wa-poll.is-multiple .wa-poll-mark { border-radius: 4px; }
.wa-poll-option-name { min-width: 0; line-height: 1.3; }
.wa-poll-foot {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem;
  margin-top: 0.55rem; font-size: 0.65rem; color: var(--ib-ink-mute);
}
.wa-poll-foot .ri-checkbox-circle-line, .wa-poll-foot .ri-checkbox-multiple-line { color: var(--ib-brand); }
.wa-poll-note { margin-left: auto; font-style: italic; }
html[data-bs-theme="dark"] .wa-poll-option { background: #16202d; border-color: rgba(120, 190, 220, 0.18); }

/* Diálogo para crear encuestas */
.poll-dialog { max-width: 480px; }
.poll-dialog .poll-label {
  display: block; margin: 0.7rem 0 0.25rem;
  font-size: 0.64rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.055em; color: var(--esam-muted);
}
.poll-dialog .form-control {
  border-radius: 10px; font-size: 0.85rem;
  background: var(--esam-surface-2); color: var(--esam-ink); border-color: var(--esam-line-strong);
}
.poll-dialog .form-control::placeholder { color: var(--esam-muted); }
.poll-dialog .form-control:focus {
  background: var(--esam-surface); color: var(--esam-ink);
  border-color: var(--brand); box-shadow: var(--esam-ring);
}
html[data-bs-theme="dark"] .poll-dialog .form-control { border-color: var(--esam-line-strong); }
html[data-bs-theme="dark"] .poll-dialog .form-control:focus { border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(79, 179, 214, 0.2); }
.poll-options { display: flex; flex-direction: column; gap: 0.35rem; }
.poll-option-row { display: flex; align-items: center; gap: 0.4rem; }
.poll-option-n { width: 1.2rem; flex-shrink: 0; text-align: center; font-size: 0.7rem; font-weight: 700; color: var(--esam-muted); }
.poll-option { flex: 1; min-width: 0; }
.poll-option-del {
  flex-shrink: 0; width: 28px; height: 28px; border: 0; border-radius: 8px;
  background: transparent; color: var(--esam-muted); cursor: pointer;
}
.poll-option-del:hover:not(:disabled) { color: #dc3545; background: rgba(220, 53, 69, 0.1); }
.poll-option-del:disabled { opacity: 0.25; cursor: default; }
.poll-add {
  display: inline-flex; align-items: center; gap: 0.3rem;
  border: 0; background: transparent; color: var(--brand);
  font-size: 0.78rem; font-weight: 700; padding: 0.38rem 0; cursor: pointer;
}
.poll-add:hover { text-decoration: underline; }
.poll-mode { display: flex; gap: 0.4rem; margin-top: 0.85rem; }
.poll-mode label {
  flex: 1; display: flex; align-items: center; gap: 0.4rem;
  padding: 0.48rem 0.55rem; border: 1px solid var(--esam-line); border-radius: 10px;
  background: var(--esam-surface-2); font-size: 0.75rem; cursor: pointer;
}
.poll-mode label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft, rgba(4, 84, 116, 0.08)); color: var(--brand); font-weight: 700; }
.poll-mode input { accent-color: var(--brand); flex-shrink: 0; }

@media (max-width: 575.98px) {
  .pinned-summary { padding: 0.4rem 0.65rem; }
  .pinned-summary-text { flex-direction: column; align-items: flex-start; gap: 0.05rem; }
  .pinned-title { font-size: 0.59rem; }
  .wa-contact-list { min-width: 0; }
  .wa-contact-open { width: 34px; height: 34px; padding: 0; justify-content: center; }
  .wa-contact-open span:last-child { display: none; }
  .wa-poll { min-width: 0; width: 100%; }
  .wa-poll-note { width: 100%; margin-left: 0; }
  .poll-dialog { max-width: 100%; }
  .poll-mode { flex-direction: column; }
}

/* Notas › Marketing: asesores (supervisión) y prospectos de cronogramas */
.np-advisors {
  display: flex; align-items: center; gap: 0.4rem; overflow-x: auto; padding: 0.1rem 0 0.6rem; margin: -0.1rem 0 0.4rem;
  scrollbar-width: thin; --area: #d97706;
}
.np-advisors-label {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.68rem; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--area); margin-right: 0.15rem;
}
.np-advisor {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.22rem 0.7rem 0.22rem 0.25rem;
  border: 1px solid var(--nk-line, #e6ebf1); border-radius: 999px; background: var(--nk-surface, #fff);
  color: var(--esam-ink, #1f2937); font-size: 0.78rem; font-weight: 600;
  transition: border-color 150ms var(--esam-ease-out); max-width: 17rem;
}
.np-advisor:hover { border-color: var(--area); }
.np-advisor .avatar-xs { width: 24px; height: 24px; font-size: 0.6rem; flex-shrink: 0; }
.np-advisor-all { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--area) 14%, transparent); color: var(--area); }
.np-advisor-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-advisor-n { min-width: 1.3rem; padding: 0 0.35rem; border-radius: 999px; font-size: 0.68rem; text-align: center; background: color-mix(in srgb, var(--area) 12%, transparent); color: var(--area); }
.np-advisor-sub { font-size: 0.66rem; color: var(--nk-muted, #6b7280); white-space: nowrap; }
.np-advisor.on { background: var(--area); border-color: var(--area); color: #fff; box-shadow: 0 6px 14px -8px var(--area); }
.np-advisor.on .np-advisor-n { background: rgba(255, 255, 255, 0.25); color: #fff; }
.np-advisor.on .np-advisor-sub { color: rgba(255, 255, 255, 0.85); }
html[data-bs-theme="dark"] .np-advisor { background: #1d2125; border-color: #2a2f34; color: #ced4da; }

.nk-prospect, .nk-prospect-state, .nk-prospect-advisor {
  display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.05rem 0.5rem; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.nk-prospect { color: #b45309; background: #fef3e2; border: 1px solid #fcd9a8; }
.nk-prospect-advisor { color: #475569; background: #f1f5f9; }
.nk-prospect-state.is-new { color: #475569; background: #eef2f7; }
.nk-prospect-state.is-info { color: #1d4ed8; background: #e8effd; }
.nk-prospect-state.is-warm { color: #b45309; background: #fff4e5; }
.nk-prospect-state.is-off { color: #9f1239; background: #fdecef; }
.nk-prospect-state.is-ok { color: #047857; background: #e7f8f0; }
.pl-prospect { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.3rem 0 0.1rem; }
html[data-bs-theme="dark"] .nk-prospect { color: #fbbf6a; background: rgba(217, 119, 6, 0.16); border-color: rgba(217, 119, 6, 0.35); }
html[data-bs-theme="dark"] .nk-prospect-advisor, html[data-bs-theme="dark"] .nk-prospect-state.is-new { color: #cbd5e1; background: #23292f; }
html[data-bs-theme="dark"] .nk-prospect-state.is-info { color: #93b4f5; background: rgba(37, 99, 235, 0.18); }
html[data-bs-theme="dark"] .nk-prospect-state.is-warm { color: #fbbf6a; background: rgba(217, 119, 6, 0.16); }
html[data-bs-theme="dark"] .nk-prospect-state.is-off { color: #f5a3b5; background: rgba(225, 29, 72, 0.16); }
html[data-bs-theme="dark"] .nk-prospect-state.is-ok { color: #6ee7b7; background: rgba(16, 185, 129, 0.16); }

/* ── Notas: vigencia, etapa, color de área y agrupación por fechas ── */
.nk-vig, .nk-stage {
  display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.08rem 0.5rem; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700; white-space: nowrap; line-height: 1.5;
}
.nk-vig.is-overdue { color: var(--nk-danger); background: color-mix(in srgb, var(--nk-danger) 13%, transparent); }
.nk-vig.is-today { color: var(--nk-warn); background: color-mix(in srgb, var(--nk-warn) 15%, transparent); }
.nk-vig.is-valid { color: var(--nk-ok); background: color-mix(in srgb, var(--nk-ok) 13%, transparent); }
.nk-vig.is-none { color: var(--nk-ink-soft); background: var(--nk-surface-2); }
.nk-vig.is-done { color: #0e7490; background: color-mix(in srgb, #0891b2 13%, transparent); }
.nk-stage { border: 1px solid currentColor; background: transparent; }
.nk-stage.is-todo { color: #64748b; }
.nk-stage.is-doing { color: #b45309; }
.nk-stage.is-contacted { color: #2563eb; }
.nk-stage.is-done { color: #0f7b55; }
html[data-bs-theme="dark"] .nk-stage.is-todo { color: #94a3b8; }
html[data-bs-theme="dark"] .nk-stage.is-doing { color: #f3b25f; }
html[data-bs-theme="dark"] .nk-stage.is-contacted { color: #8fb3ff; }
html[data-bs-theme="dark"] .nk-stage.is-done { color: #5fd3a6; }
html[data-bs-theme="dark"] .nk-vig.is-done { color: #67d4ea; }
.nk-status { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.35rem; }

/* Franja del color del área (lista y pipeline) */
.nk-card.nk-has-area { border-left: 4px solid var(--area); padding-left: 0.65rem; }
.notes-page .nk-card.nk-has-area { padding-left: 0.7rem; }
.pl-card.pl-has-area { border-left: 4px solid var(--area); }
.pl-vig { margin-top: 0.35rem; }

/* Leyenda de colores */
.np-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.4rem; margin: -0.15rem 0 0.75rem;
  font-size: 0.72rem; color: var(--nk-ink-soft);
}
.np-legend-t { font-weight: 600; color: var(--nk-mute); }
.np-legend-sep { width: 1px; height: 1rem; background: var(--nk-line); margin: 0 0.25rem; }
.notes-page.board-mode .np-legend .np-legend-t:last-child { display: none; }

/* Encabezados de grupo personalizados (día, mes, registro, área, etapa) */
.np-group-title.np-gt { --gc: var(--nk-brand); color: var(--nk-ink); text-transform: none; letter-spacing: 0; font-size: 0.86rem; font-weight: 800; gap: 0.5rem; }
.np-group-title.np-gt span { padding: 0; background: none; border-radius: 0; font-size: inherit; color: inherit; }
.np-group-title.np-gt .np-g-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--gc); flex-shrink: 0; }
.np-group-title.np-gt .np-g-ic { color: var(--gc); font-size: 1rem; font-weight: 400; }
.np-group-title .np-g-sub { font-size: 0.7rem; font-weight: 700; color: var(--gc); background: color-mix(in srgb, var(--gc) 12%, transparent); padding: 0.05rem 0.5rem; border-radius: 999px; }
.np-group-title.np-gt .np-g-n,
.np-group-title .np-g-n {
  font-size: 0.66rem; font-weight: 700; padding: 0.05rem 0.5rem; border-radius: 999px;
  background: var(--nk-surface-2); color: var(--nk-ink-soft); font-variant-numeric: tabular-nums;
}
.np-group-title .np-g-chip,
.np-group-title.np-gt .np-g-chip { font-size: 0.66rem; font-weight: 700; padding: 0.05rem 0.5rem; border-radius: 999px; text-transform: none; letter-spacing: 0; }
.np-group-title .np-g-chip.is-overdue { color: var(--nk-danger); background: color-mix(in srgb, var(--nk-danger) 13%, transparent); }
.np-group-title .np-g-chip.is-today { color: var(--nk-warn); background: color-mix(in srgb, var(--nk-warn) 15%, transparent); }
.np-gt-overdue { --gc: var(--nk-danger) !important; }
.np-gt-today { --gc: var(--nk-warn) !important; }
.np-gt-valid { --gc: var(--nk-ok) !important; }
.np-gt-none { --gc: var(--nk-mute) !important; }
.np-gt-reg { --gc: var(--nk-brand) !important; }
.np-gt-st-todo { --gc: #64748b !important; }
.np-gt-st-doing { --gc: #b45309 !important; }
.np-gt-st-contacted { --gc: #2563eb !important; }
.np-gt-st-done { --gc: #0f7b55 !important; }
.np-group-custom .np-group-title::after { background: linear-gradient(90deg, color-mix(in srgb, var(--gc) 40%, var(--nk-line)), transparent); }
.nk-due.nk-due-date { color: var(--nk-ink-soft); background: var(--nk-surface-2); }
.np-gt-done { --gc: #0e7490 !important; }
.pl-due.pl-due-date { color: var(--nk-ink-soft); }

/* ── Lotes: lista compacta por día y detalle del envío ── */
.batches-page, .batch-detail {
  --bt-line: var(--vz-border-color, #e6ebf1); --bt-surface: var(--vz-card-bg, #fff); --bt-soft: var(--vz-light, #f6f8fb);
  --bt-ink: var(--esam-ink, #1f2937); --bt-mute: var(--esam-muted, #6b7280); --bt-brand: var(--esam-brand, #045474);
  --bt-ok: #0f7b55; --bt-warn: #b45309; --bt-danger: #bb3b3b;
}
html[data-bs-theme="dark"] .batches-page, html[data-bs-theme="dark"] .batch-detail {
  --bt-line: #2a2f34; --bt-surface: #1d2125; --bt-soft: #23292f; --bt-ink: #dee2e6; --bt-mute: #98a2b3;
  --bt-brand: #4fb3d6; --bt-ok: #5fd3a6; --bt-warn: #f3b25f; --bt-danger: #f08484;
}
.bt-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; margin-bottom: 0.9rem; }
.bt-kpi { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.85rem; background: var(--bt-surface); border: 1px solid var(--bt-line); border-radius: 12px; }
.bt-kpi-ic { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; flex-shrink: 0;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent); }
.bt-kpi.is-brand { --tone: var(--bt-brand); } .bt-kpi.is-ok { --tone: var(--bt-ok); } .bt-kpi.is-warn { --tone: var(--bt-warn); } .bt-kpi.is-danger { --tone: var(--bt-danger); }
.bt-kpi-v { font-size: 1.3rem; font-weight: 800; line-height: 1.1; color: var(--bt-ink); font-variant-numeric: tabular-nums; }
.bt-kpi-l { font-size: 0.74rem; color: var(--bt-mute); }

.bt-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.7rem; }
.bt-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.bt-chip { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--bt-line); background: var(--bt-surface); color: var(--bt-ink);
  border-radius: 999px; padding: 0.3rem 0.7rem; font-size: 0.78rem; font-weight: 600; cursor: pointer;
  transition: border-color 150ms var(--esam-ease-out), background-color 150ms var(--esam-ease-out); }
.bt-chip b { font-size: 0.7rem; padding: 0 0.4rem; border-radius: 999px; background: var(--bt-soft); color: var(--bt-mute); font-variant-numeric: tabular-nums; }
.bt-chip:hover:not(:disabled) { border-color: var(--bt-brand); }
.bt-chip.on { background: var(--bt-brand); border-color: var(--bt-brand); color: #fff; }
.bt-chip.on b { background: rgba(255, 255, 255, 0.25); color: #fff; }
.bt-chip:disabled { opacity: 0.45; cursor: default; }
.bt-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; flex: 1 1 28rem; justify-content: flex-end; min-width: 260px; }
.bt-search { display: flex; align-items: center; gap: 0.4rem; flex: 1; max-width: 26rem; min-width: 200px; border: 1px solid var(--bt-line); border-radius: 10px;
  padding: 0.35rem 0.65rem; background: var(--bt-surface); margin: 0; }
.bt-search i { color: var(--bt-mute); }
.bt-search input { border: 0; outline: none; background: transparent; width: 100%; font-size: 0.82rem; color: var(--bt-ink); }
.bt-search:focus-within { border-color: var(--bt-brand); }
.bt-filters .form-select { width: auto; max-width: 16rem; border-radius: 10px; font-size: 0.8rem; }

.bt-head, .bt-row { display: grid; grid-template-columns: 4.2rem minmax(0, 2.3fr) minmax(0, 1.4fr) minmax(9rem, 1.2fr) 8.5rem 7.5rem; gap: 0.8rem; align-items: center; }
.bt-head { padding: 0 0.85rem 0.35rem; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--bt-mute); }
.bt-day + .bt-day { margin-top: 1rem; }
.bt-day-h { display: flex; align-items: baseline; gap: 0.6rem; margin: 0 0 0.45rem; font-size: 0.86rem; font-weight: 800; color: var(--bt-ink); }
.bt-day-h small { font-size: 0.74rem; font-weight: 600; color: var(--bt-mute); }
.bt-rows { background: var(--bt-surface); border: 1px solid var(--bt-line); border-radius: 12px; overflow: hidden; }
.bt-row { padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--bt-line); transition: background 0.12s ease; }
.bt-row:last-child { border-bottom: 0; }
.bt-row:hover { background: var(--bt-soft); }
.bt-time { display: flex; flex-direction: column; line-height: 1.2; }
.bt-time b { font-size: 0.88rem; color: var(--bt-ink); font-variant-numeric: tabular-nums; }
.bt-time span { font-size: 0.7rem; color: var(--bt-mute); }
.bt-main { min-width: 0; }
.bt-name { display: block; font-weight: 700; font-size: 0.86rem; color: var(--bt-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-name:hover { color: var(--bt-brand); }
.bt-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.2rem; }
.bt-tag { display: inline-flex; align-items: center; gap: 0.2rem; max-width: 100%; padding: 0.02rem 0.45rem; border-radius: 999px; font-size: 0.68rem; font-weight: 600;
  color: var(--bt-brand); background: color-mix(in srgb, var(--bt-brand) 10%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-tag.is-type { color: #7c3aed; background: color-mix(in srgb, #7c3aed 10%, transparent); }
.bt-tag.is-origin { color: var(--bt-mute); background: var(--bt-soft); }
.bt-warn, .bt-sched { font-size: 0.72rem; margin-top: 0.2rem; }
.bt-warn { color: var(--bt-warn); } .bt-sched { color: var(--bt-brand); }
.bt-who { min-width: 0; font-size: 0.78rem; }
.bt-line { display: flex; align-items: center; gap: 0.3rem; color: var(--bt-ink); }
.bt-line i { color: #25a35a; }
.bt-person { color: var(--bt-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-person span { color: var(--bt-mute); }
.bt-prog-top { display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--bt-mute); margin-bottom: 0.2rem; }
.bt-prog-top b { color: var(--bt-ink); }
.bt-pct { font-weight: 700; color: var(--bt-ink); }
.bt-prog-sub { display: flex; gap: 0.5rem; font-size: 0.7rem; margin-top: 0.15rem; min-height: 0.9rem; }
.bt-act { display: flex; justify-content: flex-end; gap: 0.3rem; }
.bt-empty { text-align: center; padding: 2rem 1rem; color: var(--bt-mute); }
.bt-foot { font-size: 0.74rem; color: var(--bt-mute); margin: 0.8rem 0 0; }

@media (max-width: 1199.98px) {
  .bt-head { display: none; }
  .bt-row { grid-template-columns: 3.6rem minmax(0, 1fr) auto; grid-template-areas: 'time main state' 'time who who' 'time prog prog' 'time act act'; row-gap: 0.4rem; }
  .bt-time { grid-area: time; align-self: start; } .bt-main { grid-area: main; } .bt-state { grid-area: state; align-self: start; }
  .bt-who { grid-area: who; display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; } .bt-prog { grid-area: prog; } .bt-act { grid-area: act; justify-content: flex-start; }
}
@media (max-width: 767.98px) {
  .bt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bt-filters { justify-content: stretch; min-width: 0; } .bt-search { max-width: none; }
}

/* Detalle del envío */
.bd-head { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.9rem; }
.bd-back { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--bt-line); display: inline-flex; align-items: center; justify-content: center;
  color: var(--bt-ink); background: var(--bt-surface); flex-shrink: 0; }
.bd-back:hover { border-color: var(--bt-brand); color: var(--bt-brand); }
.bd-title { flex: 1; min-width: 0; }
.bd-title h4 { margin: 0 0 0.25rem; font-size: 1.1rem; font-weight: 800; color: var(--bt-ink); overflow-wrap: anywhere; }
.bd-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(12rem, 1.6fr); gap: 0.6rem; margin-bottom: 0.8rem; }
.bd-kpi, .bd-progress { background: var(--bt-surface); border: 1px solid var(--bt-line); border-radius: 12px; padding: 0.65rem 0.8rem; }
.bd-kpi { border-top: 3px solid var(--tone); }
.bd-kpi.is-brand { --tone: var(--bt-brand); } .bd-kpi.is-ok { --tone: var(--bt-ok); } .bd-kpi.is-danger { --tone: var(--bt-danger); }
.bd-kpi.is-warn { --tone: var(--bt-warn); } .bd-kpi.is-mute { --tone: var(--bt-mute); }
.bd-kpi-v { font-size: 1.35rem; font-weight: 800; color: var(--tone); line-height: 1.1; font-variant-numeric: tabular-nums; }
.bd-kpi-l { font-size: 0.74rem; color: var(--bt-mute); }
.bd-progress { display: flex; flex-direction: column; justify-content: center; gap: 0.35rem; }
.bd-progress-top { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--bt-mute); }
.bd-progress-top b { color: var(--bt-ink); }
.bd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.9rem; }
.bd-schedule { display: flex; gap: 0.35rem; align-items: center; margin-left: auto; }
.bd-schedule input { max-width: 13rem; }
.bd-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0.8rem; margin-bottom: 0.8rem; align-items: start; }
.bd-col { display: flex; flex-direction: column; gap: 0.8rem; min-width: 0; }
.bd-card { background: var(--bt-surface); border: 1px solid var(--bt-line); border-radius: 14px; padding: 0.85rem 1rem; min-width: 0; }
.bd-card-h { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.65rem; }
.bd-card-h > span:first-child { color: var(--bt-brand); font-size: 1.05rem; }
.bd-card-h h6 { margin: 0; font-weight: 800; font-size: 0.9rem; color: var(--bt-ink); flex: 1; }
.bd-pill { font-size: 0.7rem; font-weight: 700; padding: 0.05rem 0.55rem; border-radius: 999px; background: var(--bt-soft); color: var(--bt-mute); }
.bd-kvs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.15rem 1rem; margin: 0; }
.bd-kv { display: flex; flex-direction: column; padding: 0.35rem 0; border-bottom: 1px dashed var(--bt-line); min-width: 0; }
.bd-kv dt { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--bt-mute); }
.bd-kv dd { margin: 0; font-size: 0.84rem; color: var(--bt-ink); overflow-wrap: anywhere; }
.bd-bubble-wrap { background: #efe7dd; border-radius: 12px; padding: 0.75rem; }
html[data-bs-theme="dark"] .bd-bubble-wrap { background: #15191c; }
.bd-bubble { background: #d9fdd3; color: #111b21; border-radius: 10px 10px 10px 3px; padding: 0.6rem 0.75rem; font-size: 0.85rem; white-space: pre-wrap;
  overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08); max-height: 22rem; overflow-y: auto; }
html[data-bs-theme="dark"] .bd-bubble { background: #005c4b; color: #e9edef; }
.bd-sample { font-size: 0.72rem; font-weight: 700; color: #54656f; margin-bottom: 0.35rem; }
.bd-media { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; font-size: 0.76rem; color: #3b4a54; background: rgba(255, 255, 255, 0.7);
  border-radius: 8px; padding: 0.3rem 0.55rem; margin-bottom: 0.45rem; max-width: 100%; overflow-wrap: anywhere; }
html[data-bs-theme="dark"] .bd-sample, html[data-bs-theme="dark"] .bd-media { color: #cfd8dc; background: rgba(255, 255, 255, 0.06); }
.bd-errors ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.bd-errors li { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.8rem; color: var(--bt-ink); }
.bd-errors li b { min-width: 2rem; text-align: center; border-radius: 999px; padding: 0 0.4rem; color: var(--bt-danger); background: color-mix(in srgb, var(--bt-danger) 12%, transparent); }
.bd-items-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.6rem; }
.bd-table td { font-size: 0.8rem; vertical-align: top; }
.bd-dest { font-weight: 600; color: var(--bt-ink); }
.bd-phone { font-size: 0.74rem; color: var(--bt-mute); }
.bd-phone:hover { color: var(--bt-brand); }
.bd-msg { max-width: 30rem; color: var(--bt-mute); }
.bd-msg summary { cursor: pointer; list-style: none; }
.bd-msg summary::-webkit-details-marker { display: none; }
.bd-msg summary::after { content: ' Ver completo'; color: var(--bt-brand); font-weight: 600; font-size: 0.72rem; }
.bd-msg details[open] summary { display: none; }
.bd-full { white-space: pre-wrap; color: var(--bt-ink); overflow-wrap: anywhere; }
.bd-err { color: var(--bt-danger); font-size: 0.76rem; max-width: 18rem; overflow-wrap: anywhere; }
.bd-ref { color: var(--bt-mute); font-size: 0.68rem; font-family: var(--bs-font-monospace, monospace); }
@media (max-width: 1199.98px) {
  .bd-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .bd-progress { grid-column: 1 / -1; }
  .bd-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767.98px) {
  .bd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bd-kvs { grid-template-columns: minmax(0, 1fr); }
  .bd-schedule { margin-left: 0; width: 100%; }
  .bd-schedule input { max-width: none; flex: 1; }
}
@media (max-width: 1199.98px) {
  .bt-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

/* ── Reportes › Envíos masivos ── */
.mass-activity { --ma-brand: var(--esam-brand, #045474); --ma-line: var(--vz-border-color, #e6ebf1); --ma-soft: var(--vz-light, #f6f8fb); --ma-mute: var(--esam-muted, #6b7280); }
html[data-bs-theme="dark"] .mass-activity { --ma-brand: #4fb3d6; --ma-line: #2a2f34; --ma-soft: #23292f; --ma-mute: #98a2b3; }
.ma-person { display: flex; align-items: center; gap: 0.55rem; min-width: 12rem; }
.ma-person b { display: block; font-size: 0.85rem; }
.ma-person small { display: block; font-size: 0.72rem; color: var(--ma-mute); }
.ma-av { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, #045474, #0e9f6e); }
.ma-table td { font-size: 0.82rem; vertical-align: middle; }
.ma-table small { font-size: 0.72rem; color: var(--ma-mute); }
.ma-big { font-size: 1.05rem; }
.ma-lines { font-size: 0.74rem; max-width: 14rem; }
.ma-lines span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-table tr.ma-on td { background: color-mix(in srgb, var(--ma-brand) 8%, transparent); }

.ma-cal { font-size: 0.74rem; text-align: center; }
.ma-cal th, .ma-cal td { border-color: var(--ma-line); padding: 0.3rem 0.25rem; }
.ma-cal .ma-cal-p { text-align: left; white-space: nowrap; font-weight: 700; position: sticky; left: 0; background: var(--vz-card-bg, #fff); z-index: 1; min-width: 9rem; }
html[data-bs-theme="dark"] .ma-cal .ma-cal-p { background: #1d2125; }
.ma-dh { font-weight: 600; color: var(--ma-mute); white-space: nowrap; min-width: 2.6rem; }
.ma-dh span { display: block; font-size: 0.64rem; text-transform: capitalize; }
.ma-c0 { color: var(--ma-line); }
.ma-c { font-weight: 800; border-radius: 6px; cursor: default; }
.ma-c small { display: block; font-size: 0.6rem; font-weight: 600; opacity: 0.8; }
.ma-l1 { background: color-mix(in srgb, #0e9f6e 14%, transparent); color: #0f7b55; }
.ma-l2 { background: color-mix(in srgb, #0e9f6e 28%, transparent); color: #0b5e41; }
.ma-l3 { background: color-mix(in srgb, #d97706 30%, transparent); color: #92400e; }
.ma-l4 { background: color-mix(in srgb, #dc2626 30%, transparent); color: #991b1b; }
html[data-bs-theme="dark"] .ma-l1, html[data-bs-theme="dark"] .ma-l2 { color: #6ee7b7; }
html[data-bs-theme="dark"] .ma-l3 { color: #fbbf6a; }
html[data-bs-theme="dark"] .ma-l4 { color: #fca5a5; }
.ma-tot { font-weight: 800; }

.ma-day + .ma-day { margin-top: 1rem; }
.ma-day-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; font-size: 0.86rem; font-weight: 800; margin: 0 0 0.35rem; }
.ma-day-h small { font-size: 0.74rem; font-weight: 600; color: var(--ma-mute); }
.ma-log { border: 1px solid var(--ma-line); border-radius: 10px; overflow: hidden; }
.ma-log td { font-size: 0.8rem; vertical-align: middle; border-color: var(--ma-line); }
.ma-log small { display: block; font-size: 0.72rem; color: var(--ma-mute); }
.ma-t { font-weight: 800; font-variant-numeric: tabular-nums; width: 4rem; }
.ma-who { min-width: 11rem; }
.ma-lote { min-width: 14rem; }
.ma-lote a { font-weight: 700; color: inherit; }
.ma-lote a:hover { color: var(--ma-brand); }
.ma-n { text-align: center; width: 5.5rem; }
.ma-n b { font-size: 1rem; }
.ma-res span { display: block; font-size: 0.74rem; white-space: nowrap; }
.ma-dur { white-space: nowrap; color: var(--ma-mute); }
.ma-empty { text-align: center; color: var(--ma-mute); padding: 1.5rem; }
.mass-activity .ab-card .card-header .ma-filter { width: auto; min-width: 14rem; }
/* Bootstrap pinta el fondo de las celdas con --bs-table-bg: se usa esa variable para el calor. */
.ma-cal { width: auto; min-width: min(100%, 36rem); }
.ma-cal td.ma-l1 { --bs-table-bg: color-mix(in srgb, #0e9f6e 16%, transparent); }
.ma-cal td.ma-l2 { --bs-table-bg: color-mix(in srgb, #0e9f6e 32%, transparent); }
.ma-cal td.ma-l3 { --bs-table-bg: color-mix(in srgb, #d97706 32%, transparent); }
.ma-cal td.ma-l4 { --bs-table-bg: color-mix(in srgb, #dc2626 32%, transparent); }
.ma-cal tr.ma-on > *:not(.ma-c) { --bs-table-bg: color-mix(in srgb, var(--ma-brand) 10%, transparent); }
.ma-table tr.ma-on > * { --bs-table-bg: color-mix(in srgb, var(--ma-brand) 8%, transparent); }
.ma-cal td.ma-l1 { background-color: color-mix(in srgb, #0e9f6e 16%, transparent) !important; }
.ma-cal td.ma-l2 { background-color: color-mix(in srgb, #0e9f6e 32%, transparent) !important; }
.ma-cal td.ma-l3 { background-color: color-mix(in srgb, #d97706 32%, transparent) !important; }
.ma-cal td.ma-l4 { background-color: color-mix(in srgb, #dc2626 32%, transparent) !important; }

/* ── Ficha del contacto › Envíos del sistema ── */
.contact-sends { --ps-line: var(--vz-border-color, #e6ebf1); --ps-soft: var(--vz-light, #f6f8fb); --ps-mute: var(--esam-muted, #6b7280); --ps-ink: var(--esam-ink, #1f2937); }
html[data-bs-theme="dark"] .contact-sends { --ps-line: #2a2f34; --ps-soft: #23292f; --ps-mute: #98a2b3; --ps-ink: #dee2e6; }
.ps-areas { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.45rem; margin-bottom: 0.65rem; }
.ps-area { border: 1px solid var(--ps-line); border-left: 4px solid var(--tone); border-radius: 10px; padding: 0.45rem 0.6rem; background: var(--vz-card-bg, #fff); }
html[data-bs-theme="dark"] .ps-area { background: #1d2125; }
.ps-area.is-ok { --tone: #0e9f6e; } .ps-area.is-warn { --tone: #d97706; } .ps-area.is-none { --tone: #94a3b8; }
.ps-area-h { display: flex; align-items: center; gap: 0.3rem; font-weight: 800; font-size: 0.8rem; color: var(--ps-ink); }
.ps-area-h span { color: var(--tone); }
.ps-area-h b { margin-left: auto; font-size: 0.95rem; }
.ps-area-s { font-size: 0.72rem; font-weight: 700; color: var(--tone); }
.ps-area-d { font-size: 0.68rem; color: var(--ps-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-area-f { font-size: 0.68rem; color: #dc2626; font-weight: 600; }
.ps-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.6rem; }
.ps-chip { display: inline-flex; align-items: center; gap: 0.25rem; border: 1px solid var(--ps-line); background: var(--vz-card-bg, #fff); color: var(--ps-ink);
  border-radius: 999px; padding: 0.18rem 0.55rem; font-size: 0.72rem; font-weight: 600; cursor: pointer; }
html[data-bs-theme="dark"] .ps-chip { background: #1d2125; }
.ps-chip b { font-size: 0.66rem; color: var(--ps-mute); }
.ps-chip span { color: var(--cat, var(--ps-mute)); }
.ps-chip.on { background: var(--cat, var(--esam-brand, #045474)); border-color: var(--cat, var(--esam-brand, #045474)); color: #fff; }
.ps-chip.on b, .ps-chip.on span { color: #fff; }
.ps-c-cobranza { --cat: #0e9f6e; } .ps-c-notas { --cat: #2563eb; } .ps-c-asistencia { --cat: #7c3aed; }
.ps-c-programa { --cat: #0891b2; } .ps-c-marketing { --cat: #d97706; } .ps-c-otros { --cat: #64748b; }
.ps-list { display: flex; flex-direction: column; gap: 0.45rem; }
.ps-item { border: 1px solid var(--ps-line); border-left: 3px solid var(--cat); border-radius: 10px; padding: 0.5rem 0.6rem; background: var(--vz-card-bg, #fff); }
html[data-bs-theme="dark"] .ps-item { background: #1d2125; }
.ps-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.4rem; }
.ps-cat { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 800; font-size: 0.8rem; color: var(--cat); }
.ps-at { font-size: 0.68rem; color: var(--ps-mute); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ps-sub { font-size: 0.74rem; color: var(--ps-ink); margin-top: 0.1rem; overflow-wrap: anywhere; }
.ps-who { font-size: 0.72rem; color: var(--ps-mute); margin-top: 0.2rem; overflow-wrap: anywhere; }
.ps-who span { margin-right: 0.2rem; }
.ps-who b { color: var(--ps-ink); }
.ps-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.3rem; }
.ps-st { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.68rem; font-weight: 700; padding: 0.02rem 0.45rem; border-radius: 999px; }
.ps-st.is-read { color: #1d4ed8; background: #e8effd; } .ps-st.is-ok { color: #047857; background: #e7f8f0; }
.ps-st.is-bad { color: #b91c1c; background: #fdecec; } .ps-st.is-wait { color: #b45309; background: #fff4e5; } .ps-st.is-off { color: #475569; background: #eef2f7; }
html[data-bs-theme="dark"] .ps-st.is-read { color: #93b4f5; background: rgba(37, 99, 235, 0.18); }
html[data-bs-theme="dark"] .ps-st.is-ok { color: #6ee7b7; background: rgba(16, 185, 129, 0.16); }
html[data-bs-theme="dark"] .ps-st.is-bad { color: #fca5a5; background: rgba(220, 38, 38, 0.18); }
html[data-bs-theme="dark"] .ps-st.is-wait { color: #fbbf6a; background: rgba(217, 119, 6, 0.16); }
html[data-bs-theme="dark"] .ps-st.is-off { color: #cbd5e1; background: #23292f; }
.ps-err { font-size: 0.68rem; color: #b91c1c; overflow-wrap: anywhere; }
.ps-batch { margin-left: auto; font-size: 0.68rem; font-weight: 600; }
.ps-msg { margin-top: 0.3rem; }
.ps-msg summary { cursor: pointer; font-size: 0.72rem; font-weight: 600; color: var(--esam-brand, #045474); }
.ps-body { margin-top: 0.3rem; padding: 0.45rem 0.55rem; border-radius: 8px; background: #d9fdd3; color: #111b21; font-size: 0.76rem; white-space: pre-wrap; overflow-wrap: anywhere; }
html[data-bs-theme="dark"] .ps-body { background: #005c4b; color: #e9edef; }
.ps-view { display: inline-flex; border: 1px solid var(--ps-line); border-radius: 10px; overflow: hidden; margin-bottom: 0.5rem; }
.ps-view-btn { border: 0; background: var(--vz-card-bg, #fff); color: var(--ps-ink); font-size: 0.72rem; font-weight: 700; padding: 0.25rem 0.6rem; display: inline-flex; align-items: center; gap: 0.25rem; cursor: pointer; }
html[data-bs-theme="dark"] .ps-view-btn { background: #1d2125; }
.ps-view-btn + .ps-view-btn { border-left: 1px solid var(--ps-line); }
.ps-view-btn.on { background: var(--esam-brand, #045474); color: #fff; }
.ps-day { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ps-mute); margin: 0.35rem 0 0.1rem; }
.ps-day:first-child { margin-top: 0; }
.ps-group + .ps-group { margin-top: 0.7rem; }
.ps-group { display: flex; flex-direction: column; gap: 0.45rem; }
.ps-group-h { display: flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; font-weight: 800; margin: 0; color: var(--ps-ink); }
.ps-group-h b { margin-left: auto; font-size: 0.72rem; color: var(--ps-mute); }
.ps-a-contabilidad .ps-group-h span { color: #0e9f6e; } .ps-a-academico .ps-group-h span { color: #2563eb; }
.ps-a-marketing .ps-group-h span { color: #d97706; } .ps-a-otros .ps-group-h span { color: #64748b; }

/* Ficha › Envíos: tarjetas más estructuradas, adjuntos (QR) y barra compacta */
.contact-sends .ps-areas { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; margin-bottom: 0.55rem; }
.contact-sends .ps-area { padding: 0.4rem 0.55rem; }
.contact-sends .ps-area-d { font-size: 0.66rem; }
.ps-toolbar { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.55rem; }
.ps-toolbar .ps-view { margin-bottom: 0; align-self: flex-start; }
.ps-toolbar .ps-chips { flex-wrap: nowrap; overflow-x: auto; margin-bottom: 0; padding-bottom: 0.2rem; scrollbar-width: thin; }
.ps-toolbar .ps-chip { flex-shrink: 0; }
.ps-item { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.ps-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 0.5rem; padding: 0.5rem 0.6rem 0.35rem; }
.ps-ic { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.95rem;
  color: var(--cat); background: color-mix(in srgb, var(--cat) 13%, transparent); }
.ps-ttl { min-width: 0; line-height: 1.25; }
.ps-ttl b { display: block; font-size: 0.8rem; color: var(--ps-ink); }
.ps-ttl small { display: block; font-size: 0.7rem; color: var(--ps-mute); overflow-wrap: anywhere; }
.ps-head .ps-at { font-size: 0.66rem; text-align: right; line-height: 1.3; max-width: 4.6rem; white-space: normal; }
.ps-mid { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0 0.6rem 0.4rem; }
.ps-kv { flex: 1; min-width: 0; margin: 0; display: grid; gap: 0.1rem; }
.ps-kv > div { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: 0.3rem; font-size: 0.72rem; }
.ps-kv dt { color: var(--ps-mute); font-weight: 600; }
.ps-kv dd { margin: 0; color: var(--ps-ink); overflow-wrap: anywhere; }
.ps-thumb { width: 64px; height: 64px; flex-shrink: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--ps-line); background: #fff; cursor: zoom-in; }
.ps-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 2px; display: block; }
.ps-file { flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.5rem;
  border-radius: 8px; border: 1px solid var(--ps-line); color: var(--ps-ink); background: var(--ps-soft); }
.ps-item .ps-foot { margin: 0; padding: 0.35rem 0.6rem; border-top: 1px dashed var(--ps-line); }
.ps-item .ps-msg { margin: 0; padding: 0 0.6rem 0.45rem; }
.ps-item .ps-msg summary { padding-top: 0.35rem; }

/* =============================================================================
   Conversaciones · jerarquía de la lista, cabecera del hilo y ficha
   El objetivo es leer de un vistazo: quién es, qué dijo y qué hay pendiente.
   ============================================================================= */

/* ── Lista: resumen y filas en tres niveles (identidad · mensaje · meta) ── */
.inbox .cl-summary {
  margin: -0.15rem 0 0.45rem;
  padding: 0 1rem;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ib-ink-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox .cl-summary:empty { display: none; }

.convo {
  align-items: center;
  gap: 0.62rem;
  padding: 0.58rem 0.65rem;
}
.convo .convo-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}
.convo .convo-top {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}
.convo .convo-top .convo-name {
  flex: 0 1 auto;
  font-size: 0.86rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.convo .convo-top .convo-time {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--ib-ink-mute);
  font-variant-numeric: tabular-nums;
}
.convo .convo-last {
  margin: 0;
  font-size: 0.77rem;
  line-height: 1.32;
  color: var(--ib-ink-soft);
}
.convo .convo-dir {
  display: inline-block;
  margin-right: 0.2rem;
  vertical-align: -1px;
  font-size: 0.78rem;
  color: #1f9d55;
}
.convo .convo-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.1rem 0.5rem;
  margin-top: 0.16rem;
  min-width: 0;
  font-size: 0.66rem;
  line-height: 1.25;
}
.convo .convo-meta > span {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.convo .convo-meta > span [class^="ri-"] { margin-right: 0.2rem; }
.convo .convo-meta .convo-prog {
  margin: 0;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ib-brand);
}
.convo .convo-meta .convo-team {
  margin: 0;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: #0e9f6e;
}
.convo .convo-meta .convo-number {
  margin: 0;
  font-size: 0.66rem;
  color: var(--ib-ink-mute);
}
.convo .convo-meta .convo-number [class^="ri-"] { color: #25a35a; font-size: 0.72rem; }
.convo .convo-meta .convo-number.is-hidden [class^="ri-"] { color: var(--ib-ink-mute); }
.convo .convo-side {
  align-self: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 0;
  padding: 0;
}
.convo.unread { background: color-mix(in srgb, var(--ib-brand) 4%, transparent); }
.convo.unread .convo-last { font-weight: 500; color: var(--ib-ink-soft); }
.convo:hover { background: var(--ib-surface); box-shadow: inset 0 0 0 1px var(--ib-line); }
.convo.active {
  background: var(--ib-surface);
  box-shadow: inset 0 0 0 1.5px var(--ib-brand), 0 6px 16px -12px rgba(6, 32, 63, 0.5);
}
html[data-bs-theme="dark"] .convo.unread { background: color-mix(in srgb, var(--ib-brand) 9%, transparent); }

/* ── Cabecera del hilo ── */
.chat-header { padding: 0.6rem 0.9rem; gap: 0.65rem; }
.chat-header .chat-id { display: flex; flex-direction: column; gap: 0.06rem; }
.chat-header .chat-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}
.chat-header .chat-title-row .name { flex: 0 1 auto; min-width: 0; }
.chat-header .chat-title-row .typing-hint { flex-shrink: 0; font-size: 0.72rem; }
.chat-header .chat-id .sub {
  gap: 0.45rem;
  font-size: 0.72rem;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.chat-header .chat-phone {
  font-weight: 600;
  color: var(--ib-ink-soft);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header .chat-phone.is-hidden { font-weight: 400; font-style: italic; color: var(--ib-ink-mute); }
.chat-header .chat-waname {
  color: var(--ib-ink-mute);
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header .chat-waname::before { content: '· '; }
.chat-header .chat-meta:empty { display: none; }
.chat-header .chat-meta .chat-progs { margin: 0.16rem 0 0; gap: 0.25rem; }
.chat-header .chat-meta .chat-programa,
.chat-header .chat-meta .chat-team {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  margin: 0;
  padding: 0.05rem 0.5rem;
  font-size: 0.62rem;
  line-height: 1.5;
}
.chat-header .chat-meta .chat-programa [class^="ri-"],
.chat-header .chat-meta .chat-team [class^="ri-"] { font-size: 0.7rem; }

/* ── Ficha: identidad, avisos y secciones ── */
.contact-panel .contact-hero {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 0.95rem 0.85rem;
  border-bottom: 1px solid var(--ib-line);
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--ib-brand) 10%, transparent), transparent 62%),
    var(--ib-surface-2);
}
.contact-panel .contact-hero-avatar { flex-shrink: 0; margin-top: 0.1rem; }
.contact-panel .contact-hero-avatar .avatar-xl {
  width: 3.6rem;
  height: 3.6rem;
  font-size: 1.25rem;
  box-shadow: 0 10px 22px -16px rgba(6, 32, 63, 0.75);
}
.contact-panel .avatar-xl.is-group { border-radius: 30%; }
.contact-panel .contact-hero-id {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  text-align: left;
}
.contact-panel .contact-hero-id .contact-name {
  margin-top: 0;
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 750;
  text-align: left;
  overflow-wrap: anywhere;
}
.contact-panel .contact-hero-id .contact-team { margin-top: 0; align-self: flex-start; }
.contact-panel .contact-hero-id .contact-namesrc { text-align: left; }
.contact-panel .contact-hero-id .contact-progs {
  justify-content: flex-start;
  margin: 0.3rem 0 0;
}
.contact-panel .contact-hero-id .contact-waname { text-align: left; font-size: 0.7rem; }
.contact-panel .contact-phone-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.12rem;
}
.contact-panel .contact-phone-row .contact-phone { font-size: 0.78rem; }
.contact-panel .contact-copy {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ib-ink-mute);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.contact-panel .contact-copy:hover { background: var(--ib-brand-soft); color: var(--ib-brand); }
.contact-panel .contact-email {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin-top: 0.14rem;
  text-align: left;
}
.contact-panel .contact-hidden-hint { margin: 0.25rem 0 0; max-width: none; }
.contact-panel .contact-name-form { max-width: none; margin: 0.5rem 0 0; }
.contact-panel .contact-name-actions { justify-content: flex-start; }

/* Avisos de la persona: pendientes, vencidas y sin leer */
.contact-panel .contact-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.55rem 0.9rem;
  background: var(--ib-surface-2);
  border-bottom: 1px solid var(--ib-line);
}
.contact-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--ib-ink-soft);
  background: var(--ib-surface-3);
  white-space: nowrap;
}
.contact-flag [class^="ri-"] { font-size: 0.8rem; }
.contact-flag.is-brand { color: var(--ib-brand); background: var(--ib-brand-soft); }
.contact-flag.is-warn { color: #92400e; background: color-mix(in srgb, #f59e0b 15%, transparent); }
.contact-flag.is-danger { color: #a92f2f; background: rgba(187, 59, 59, 0.11); }
.contact-flag.is-unread { color: #0f7b55; background: color-mix(in srgb, #0f7b55 12%, transparent); }
html[data-bs-theme="dark"] .contact-flag.is-warn { color: #f3b25f; }
html[data-bs-theme="dark"] .contact-flag.is-danger { color: #f08484; }
html[data-bs-theme="dark"] .contact-flag.is-unread { color: #5fd3a6; }

.contact-panel .panel-section[hidden] { display: none !important; }
.contact-panel .panel-section h6 { margin-bottom: 0.55rem; }
.contact-panel #person-fill-section .person-fill:not(:empty) {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.contact-panel #person-fill-section .pf-label { min-width: 4.2rem; }

/* Datos de la conversación en filas legibles */
.contact-panel .contact-meta .cm-rows { display: flex; flex-direction: column; }
.contact-panel .contact-meta .cm-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.34rem 0;
  font-size: 0.76rem;
  border-bottom: 1px dashed color-mix(in srgb, var(--ib-line) 80%, transparent);
}
.contact-panel .contact-meta .cm-row:last-child { border-bottom: 0; }
.contact-panel .contact-meta .cm-ic { flex-shrink: 0; font-size: 0.9rem; color: var(--ib-brand); }
.contact-panel .contact-meta .cm-k { font-weight: 600; color: var(--ib-ink-mute); }
.contact-panel .contact-meta .cm-v {
  margin-left: auto;
  text-align: right;
  font-weight: 700;
  color: var(--ib-ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ── Emojis del compositor: cabecera con cierre y rejilla más cómoda ── */
.composer .emoji-pop2 {
  width: 268px;
  max-height: 268px;
  padding: 0;
  border-radius: 14px;
  overscroll-behavior: contain;
}
.composer .emoji-pop2 .emoji-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem;
  background: var(--ib-surface);
  border-bottom: 1px solid var(--ib-line);
}
.composer .emoji-pop2 .emoji-head-title {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ib-ink-mute);
}
.composer .emoji-pop2 .emoji-head-title [class^="ri-"] { font-size: 0.95rem; color: var(--ib-brand); }
.composer .emoji-pop2 .emoji-close {
  margin-left: auto;
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ib-ink-mute);
  cursor: pointer;
  font-size: 0.95rem;
}
.composer .emoji-pop2 .emoji-close:hover { background: var(--ib-surface-3); color: var(--ib-ink); }
.composer .emoji-pop2 .emoji-sec { padding: 0.42rem 0.6rem 0.22rem; }
.composer .emoji-pop2 .emoji-sec-row,
.composer .emoji-pop2 .emoji-all { padding: 0 0.48rem 0.42rem; }
.composer .emoji-pop2 .emoji-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 1.15rem;
  border-radius: 9px;
}
html[data-bs-theme="dark"] .contact-panel .contact-hero {
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--ib-brand) 16%, transparent), transparent 62%),
    var(--ib-surface-2);
}

/* Ficha en pantallas chicas: el cierre queda a mano y el héroe le deja lugar */
@media (max-width: 1199.98px) {
  .contact-panel .contact-close {
    z-index: 3;
    background: var(--ib-surface);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.18);
  }
  .contact-panel .contact-hero { padding-right: 2.9rem; }
}

/* Lista angosta: la meta se recorta antes que el nombre y el mensaje */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  .convo .convo-meta { gap: 0.08rem 0.4rem; }
  .convo .convo-meta > span { max-width: 9rem; }
}

/* Cuatro solapas en una columna angosta: sin iconos para que el texto no se corte */
@media (min-width: 992px) {
  .inbox .cl-tab {
    padding: 0.34rem 0.28rem;
    gap: 0.2rem;
    font-size: 0.74rem;
  }
  .inbox .cl-tab .cl-tab-ic { display: none; }
  .inbox .cl-tab-count {
    min-width: 1.05rem;
    padding: 0 0.26rem;
    font-size: 0.62rem;
    line-height: 1.1rem;
  }
}

/* Datos de la persona: etiqueta fija y valor con su origen debajo */
.contact-panel #person-fill .pf-row {
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 1fr);
  gap: 0.02rem 0.5rem;
  align-items: baseline;
  padding: 0.32rem 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--ib-line) 80%, transparent);
}
.contact-panel #person-fill .pf-row:last-child { border-bottom: 0; }
.contact-panel #person-fill .pf-label { min-width: 0; font-size: 0.72rem; }
.contact-panel #person-fill .pf-value { font-weight: 600; }
.contact-panel #person-fill .pf-src { grid-column: 2; font-size: 0.64rem; color: var(--ib-ink-mute); }

/* Ficha: el título de Notas no se parte; los contadores bajan si no entran */
.contact-panel .nk-section .nk-section-head { flex-wrap: wrap; row-gap: 0.3rem; }
.contact-panel .nk-section .nk-section-head h6 { white-space: nowrap; }
.contact-panel .nk-section .nk-section-head .nk-counts { flex-wrap: wrap; }

/* «+N» de programas en la cabecera del hilo */
.chat-header .chat-meta .chat-programa.is-more { font-weight: 800; }

/* ══ Envíos por usuario · Seguimiento y Reportes ═════════════════════════════
   Tablas densas pero legibles: una fila por persona, desglose por origen y
   detalle expandible. Se apoya en los tokens de .fu-page / .ur-page. */
.act-card .card-header.act-head,
.team-card .card-header.team-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.6rem 1rem; padding-bottom: 0.7rem;
}
.act-head-title, .team-head-title { flex: 1 1 22rem; min-width: 0; }
.act-tools, .team-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.act-search {
  display: flex; align-items: center; gap: 0.4rem; margin: 0; flex: 1 1 11rem; min-width: 9rem;
  border: 1px solid var(--fu-line); border-radius: 9px; padding: 0.32rem 0.6rem; background: var(--esam-surface);
}
.act-search:focus-within { border-color: var(--fu-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fu-brand) 16%, transparent); }
.act-search i { color: var(--fu-mute); font-size: 0.85rem; }
.act-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 0.8rem; color: var(--esam-ink); }
.act-tools .form-select, .team-tools .form-select { flex: 0 0 auto; max-width: 11rem; font-size: 0.78rem; }

.act-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.5rem; margin: 0.15rem 0 0.9rem; }
.act-metric {
  display: flex; align-items: flex-start; gap: 0.5rem; min-width: 0;
  padding: 0.55rem 0.65rem; border: 1px solid var(--fu-line); border-radius: 10px; background: var(--esam-surface-2);
}
.act-metric-ico {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.95rem; color: var(--fu-brand); background: color-mix(in srgb, var(--fu-brand) 12%, transparent);
}
.act-metric.ok .act-metric-ico { color: var(--fu-ok); background: var(--fu-ok-soft); }
.act-metric.warn .act-metric-ico { color: var(--fu-warn); background: var(--fu-warn-soft); }
.act-metric.mute .act-metric-ico { color: var(--fu-mute); background: var(--esam-surface-3); }
.act-metric-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.act-metric-label { font-size: 0.63rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fu-mute); }
.act-metric-value { font-size: 1.15rem; font-weight: 800; color: var(--esam-ink); font-variant-numeric: tabular-nums; }
.act-metric small { font-size: 0.64rem; color: var(--fu-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.act-table-wrap, .team-scroll { max-height: 620px; overflow: auto; border: 1px solid var(--fu-line); border-radius: 10px; }
.act-table, .team-table-rich { min-width: 780px; font-variant-numeric: tabular-nums; margin: 0; }
.team-table-rich { min-width: 1040px; }
.act-table thead th, .team-table-rich thead th { position: sticky; top: 0; z-index: 2; background: var(--esam-surface-2); border-bottom: 1px solid var(--fu-line); }
.act-table thead th { font-size: 0.67rem; padding: 0.45rem 0.5rem; vertical-align: bottom; }
.act-table thead th small { display: block; margin-top: 0.1rem; font-size: 0.6rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--fu-mute); }
.act-table td { padding: 0.5rem; vertical-align: middle; }
.act-table th:first-child, .act-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--esam-surface); }
.act-table thead th:first-child { z-index: 3; background: var(--esam-surface-2); }
.act-table tbody tr:hover td:first-child { background: var(--esam-surface-2); }
.act-person { display: flex; align-items: center; gap: 0.55rem; min-width: 12rem; }
.act-avatar {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.66rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, #045474, #0e9f6e);
}
.act-person-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.act-person-name { font-size: 0.83rem; font-weight: 700; color: var(--esam-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-person-sub { font-size: 0.66rem; color: var(--fu-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-num { text-align: right; white-space: nowrap; }
.act-num b { font-size: 0.9rem; color: var(--esam-ink); }
.act-num small { display: block; font-size: 0.64rem; color: var(--fu-mute); }
.act-total b { font-size: 1rem; }
.act-share { display: block; height: 4px; width: 68px; margin: 0.15rem 0 0.1rem auto; border-radius: 999px; background: var(--esam-surface-3); overflow: hidden; }
.act-share span { display: block; height: 100%; border-radius: inherit; background: var(--fu-brand); }
.act-when { text-align: right; font-size: 0.72rem; white-space: nowrap; color: var(--esam-ink-soft); }
.act-when small { display: block; font-size: 0.64rem; color: var(--fu-mute); }
.act-open { text-align: right; width: 3rem; }
.act-toggle { padding: 0.2rem 0.4rem; line-height: 1; }
.act-toggle i { display: inline-block; transition: transform 0.15s ease; }
.act-row.is-open .act-toggle i { transform: rotate(180deg); }
.act-table tfoot th { position: static; background: var(--esam-surface-2); font-size: 0.7rem; padding: 0.45rem 0.5rem; color: var(--esam-ink); }
.act-table tfoot th small { display: block; font-size: 0.62rem; font-weight: 600; color: var(--fu-mute); }
.act-table tfoot th:first-child { text-align: left; }

.act-detail > td { background: var(--esam-surface-2); padding: 0.85rem 0.95rem 0.95rem !important; border-top: 0; }
.act-detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 1.1rem; }
.act-detail h6 { display: flex; align-items: center; gap: 0.35rem; margin: 0 0 0.45rem; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fu-mute); }
.act-lots { list-style: none; margin: 0; padding: 0; }
.act-lot { display: grid; grid-template-columns: 6.2rem minmax(0, 1fr) 4.2rem 7rem; gap: 0.55rem; align-items: center; padding: 0.38rem 0; border-bottom: 1px dashed var(--fu-line); font-size: 0.76rem; }
.act-lot:last-child { border-bottom: 0; }
.act-lot-time { font-size: 0.68rem; color: var(--fu-mute); white-space: nowrap; }
.act-lot-main { min-width: 0; }
.act-lot-main a { display: block; font-weight: 700; color: var(--esam-ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-lot-main a:hover { color: var(--fu-brand); text-decoration: underline; }
.act-lot-main small { display: block; font-size: 0.64rem; color: var(--fu-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-lot-num { text-align: right; }
.act-lot-num b { font-size: 0.84rem; color: var(--esam-ink); }
.act-lot-num small { display: block; font-size: 0.62rem; color: var(--fu-mute); }
.act-lot-res { display: flex; flex-direction: column; font-size: 0.64rem; font-weight: 700; line-height: 1.25; }
.act-lot-res .is-ok { color: var(--fu-ok); }
.act-lot-res .is-bad { color: var(--fu-late); }
.act-days { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.28rem; }
.act-days li { display: grid; grid-template-columns: 3rem minmax(0, 1fr) 2.2rem; gap: 0.45rem; align-items: center; font-size: 0.68rem; }
.act-day-label { color: var(--fu-mute); font-variant-numeric: tabular-nums; }
.act-day-bar { display: flex; height: 7px; border-radius: 999px; background: var(--esam-surface-3); overflow: hidden; }
.act-day-bar i { display: block; height: 100%; }
.act-day-bar .is-cron, .ur-origin-track .is-cron, .ur-origin-dot.is-cron { background: #1baf7a; }
.act-day-bar .is-lote, .ur-origin-track .is-lote, .ur-origin-dot.is-lote { background: #2a78d6; }
.act-day-bar .is-band, .ur-origin-track .is-band, .ur-origin-dot.is-band { background: #98a2b3; }
.act-days li b { text-align: right; font-size: 0.7rem; color: var(--esam-ink); }
.act-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem 0.55rem; margin: 0.5rem 0 0; font-size: 0.62rem; color: var(--fu-mute); }
.act-legend span { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 0.15rem; }
.act-legend .is-cron { background: #1baf7a; }
.act-legend .is-lote { background: #2a78d6; }
.act-legend .is-band { background: #98a2b3; }
.act-empty-line { margin: 0.7rem 0 0; font-size: 0.76rem; color: var(--fu-mute); text-align: center; }
.act-hint { display: flex; align-items: flex-start; gap: 0.35rem; margin: 0.6rem 0 0; font-size: 0.68rem; line-height: 1.4; color: var(--fu-mute); }
.act-hint i { flex: 0 0 auto; margin-top: 0.1rem; }

/* Equipo: cabecera agrupada y cifras alineadas */
.team-table-rich thead th { font-size: 0.64rem; padding: 0.4rem 0.45rem; vertical-align: middle; }
.team-groups th { background: var(--esam-surface-3) !important; font-size: 0.61rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fu-mute); border-bottom: 1px solid var(--fu-line); }
.team-cols th { background: var(--esam-surface-2) !important; font-size: 0.6rem; font-weight: 700; color: var(--fu-mute); text-transform: none; letter-spacing: 0; }
.team-table-rich td { padding: 0.48rem 0.45rem; vertical-align: middle; }
.team-table-rich td:first-child { position: sticky; left: 0; z-index: 1; background: var(--esam-surface); }
.team-table-rich tbody tr:hover td:first-child { background: var(--esam-surface-2); }
.team-num { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.team-num b { font-size: 0.85rem; color: var(--esam-ink); }
.team-num small { font-size: 0.62rem; font-weight: 600; color: var(--fu-mute); white-space: nowrap; }
.team-total b { font-size: 0.98rem; }
.team-table-rich .team-open { padding: 0.26rem 0.5rem; font-size: 0.72rem; }
.team-table-rich .team-open i { font-size: 0.78rem; }

/* Ficha individual: origen de los envíos */
.ur-origin { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.ur-origin li { display: grid; grid-template-columns: minmax(0, 10.5rem) minmax(0, 1fr) 3.6rem 2.6rem; gap: 0.55rem; align-items: center; font-size: 0.76rem; }
.ur-origin-label { display: flex; flex-direction: column; min-width: 0; font-weight: 600; color: var(--esam-ink); line-height: 1.25; }
.ur-origin-label small { font-size: 0.63rem; font-weight: 500; color: var(--esam-muted); }
.ur-origin-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 0.3rem; }
.ur-origin-track { height: 8px; border-radius: 999px; background: var(--esam-surface-3); overflow: hidden; }
.ur-origin-track span { display: block; height: 100%; border-radius: inherit; }
.ur-origin li > b { text-align: right; font-size: 0.88rem; color: var(--esam-ink); }
.ur-origin li > small { text-align: right; font-size: 0.68rem; color: var(--esam-muted); }
.ur-origin-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.55rem; margin-top: 0.85rem; padding-top: 0.7rem; border-top: 1px solid var(--fu-line); }
.ur-origin-facts span { font-size: 0.66rem; color: var(--esam-muted); }
.ur-origin-facts b { display: block; font-size: 1rem; font-weight: 800; color: var(--esam-ink); font-variant-numeric: tabular-nums; }

@media (max-width: 1399.98px) {
  .act-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  .act-detail-grid { grid-template-columns: 1fr; }
  .act-metric small { white-space: normal; }
}
@media (max-width: 767.98px) {
  .act-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .act-metric:first-child { grid-column: 1 / -1; }
  .act-tools, .team-tools { width: 100%; }
  .act-search { flex: 1 1 100%; }
  .act-tools .form-select, .team-tools .form-select { flex: 1 1 9rem; max-width: none; }
  .act-lot { grid-template-columns: 4.4rem minmax(0, 1fr) 4rem; }
  .act-lot-res { display: none; }
  .ur-origin li { grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) 3.2rem; }
  .ur-origin li > small { display: none; }
  .ur-origin-facts { grid-template-columns: 1fr 1fr; }
}

/* La cabecera en dos filas del equipo: la segunda se pega debajo de la primera. */
.team-table-rich thead tr:nth-child(2) th { top: 27px; }
.act-table tbody tr[hidden] { display: none; }

/* La fila de detalle ocupa todo el ancho: no hereda la columna fija. */
.act-table .act-detail > td { position: static; left: auto; }

/* Configuración › Consistencia de líneas */
.lines-health { --lh-line: var(--vz-border-color, #e6ebf1); --lh-mute: var(--esam-muted, #6b7280); --lh-card: var(--vz-card-bg, #fff); }
html[data-bs-theme="dark"] .lines-health, html[data-bs-theme="dark"] .lh-card { --lh-line: #2a2f34; --lh-mute: #98a2b3; --lh-card: #1d2125; }
.lh-intro { font-size: 0.84rem; color: var(--lh-mute); max-width: 62rem; }
.lh-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 9rem)); gap: 0.6rem; margin-bottom: 1rem; }
.lh-sum-i { background: var(--lh-card); border: 1px solid var(--lh-line); border-top: 3px solid var(--tone); border-radius: 12px; padding: 0.55rem 0.8rem; }
.lh-sum-i b { display: block; font-size: 1.35rem; color: var(--tone); line-height: 1.1; }
.lh-sum-i span { font-size: 0.74rem; color: var(--lh-mute); }
.lh-sum-i.is-danger, .lh-issue.is-danger { --tone: #dc3545; }
.lh-sum-i.is-warn, .lh-issue.is-warn { --tone: #d97706; }
.lh-sum-i.is-info, .lh-issue.is-info { --tone: #0891b2; }
.lh-list { display: flex; flex-direction: column; gap: 0.75rem; }
.lh-issue { background: var(--lh-card); border: 1px solid var(--lh-line); border-left: 4px solid var(--tone); border-radius: 12px; padding: 0.8rem 1rem; }
.lh-issue-h { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.lh-issue-h h6 { margin: 0; font-weight: 800; font-size: 0.92rem; }
.lh-sev { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.68rem; font-weight: 800; padding: 0.1rem 0.5rem; border-radius: 999px;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 12%, transparent); text-transform: uppercase; letter-spacing: 0.03em; }
.lh-detail { font-size: 0.84rem; margin-bottom: 0.35rem; }
.lh-user { font-size: 0.78rem; color: var(--lh-mute); margin-bottom: 0.45rem; }
.lh-table { font-size: 0.8rem; }
.lh-id { display: block; font-size: 0.68rem; color: var(--lh-mute); }
.lh-fixes { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.35rem; }
.lh-hint { font-size: 0.78rem; color: var(--lh-mute); margin: 0; }
.lh-ok { text-align: center; padding: 2.5rem 1rem; background: var(--lh-card); border: 1px solid var(--lh-line); border-radius: 14px; }
.lh-ok span { font-size: 2.6rem; color: #0e9f6e; }
.lh-ok p { color: var(--lh-mute); margin: 0; }
.lh-card { display: flex; align-items: center; gap: 0.75rem; height: 100%; padding: 0.85rem 1rem; border-radius: 14px; border: 1px solid var(--lh-line, #e6ebf1);
  border-left: 4px solid var(--tone); background: var(--lh-card, #fff); color: inherit; text-decoration: none; }
.lh-card:hover { color: inherit; box-shadow: var(--esam-shadow-sm, 0 2px 6px -2px rgba(14, 26, 43, 0.08)); }
.lh-card.lh-danger { --tone: #dc3545; } .lh-card.lh-warning { --tone: #d97706; } .lh-card.lh-success { --tone: #0e9f6e; }
.lh-card-ic { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 12%, transparent); }
.lh-card-txt { flex: 1; min-width: 0; }
.lh-card-txt b { display: block; font-size: 0.9rem; }
.lh-card-txt small { color: var(--tone); font-weight: 700; }
@media (max-width: 575.98px) { .lh-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Conexión › semáforo del número */
.lv-card { --lv: #0e9f6e; margin-bottom: 1rem;
  background: var(--vz-card-bg, #fff); border: 1px solid var(--vz-border-color, #e6ebf1); border-left: 5px solid var(--lv); border-radius: 14px; padding: 0.9rem 1.1rem; }
html[data-bs-theme="dark"] .lv-card { background: #1d2125; border-color: #2a2f34; }
.lv-card.lv-yellow { --lv: #d97706; } .lv-card.lv-red { --lv: #dc3545; }
.lv-light { display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 12px; background: #1f2937; }
.lv-light span { width: 16px; height: 16px; border-radius: 50%; opacity: 0.18; }
.lv-r { background: #ef4444; } .lv-y { background: #f59e0b; } .lv-g { background: #22c55e; }
.lv-red .lv-r, .lv-yellow .lv-y, .lv-green .lv-g { opacity: 1; box-shadow: 0 0 10px currentColor; }
.lv-red .lv-r { color: #ef4444; } .lv-yellow .lv-y { color: #f59e0b; } .lv-green .lv-g { color: #22c55e; }
.lv-main h6 { margin: 0 0 0.25rem; font-weight: 800; color: var(--lv); font-size: 0.95rem; }
.lv-reasons { margin: 0; padding-left: 1.1rem; font-size: 0.82rem; }
.lv-reasons li + li { margin-top: 0.1rem; }
.lv-action { margin: 0.35rem 0 0; font-size: 0.8rem; font-weight: 600; }
.lv-figs { display: grid; grid-template-columns: repeat(2, minmax(5.5rem, auto)); gap: 0.35rem 0.8rem; }
.lv-fig b { display: block; font-size: 1rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lv-fig span { font-size: 0.68rem; color: var(--esam-muted, #6b7280); }
.lv-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1rem; align-items: center; }
.lv-why { border-top: 1px dashed var(--vz-border-color, #e6ebf1); margin-top: 0.85rem; padding-top: 0.75rem; }
html[data-bs-theme="dark"] .lv-why { border-color: #2a2f34; }
.lv-why h6 { margin: 0 0 0.3rem; font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--esam-muted, #6b7280); }
.lv-legend { margin: 0 0 0.6rem; font-size: 0.78rem; }
.lv-legend span { font-weight: 700; } .lv-legend .is-g { color: #0e9f6e; } .lv-legend .is-y { color: #d97706; } .lv-legend .is-r { color: #dc3545; }
.lv-checks { display: flex; flex-direction: column; gap: 0.35rem; }
.lv-check { --c: #0e9f6e; border: 1px solid var(--vz-border-color, #e6ebf1); border-radius: 10px; background: color-mix(in srgb, var(--c) 4%, transparent); }
html[data-bs-theme="dark"] .lv-check { border-color: #2a2f34; }
.lv-check.is-warn { --c: #d97706; border-color: color-mix(in srgb, #d97706 40%, transparent); }
.lv-check.is-bad { --c: #dc3545; border-color: color-mix(in srgb, #dc3545 40%, transparent); }
.lv-check.is-info { --c: #6b7280; }
.lv-check summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 0.5rem; align-items: center; padding: 0.45rem 0.7rem; cursor: pointer; list-style: none; font-size: 0.82rem; }
.lv-check summary::-webkit-details-marker { display: none; }
.lv-check summary::after { content: '\ea4e'; font-family: remixicon; color: var(--esam-muted, #6b7280); transition: transform 0.15s; }
.lv-check[open] summary::after { transform: rotate(180deg); }
.lv-check summary > i { color: var(--c); font-size: 1.05rem; }
.lv-check-l { font-weight: 700; }
.lv-check-v { font-size: 0.78rem; color: var(--esam-muted, #6b7280); text-align: right; }
.lv-check.is-warn .lv-check-v, .lv-check.is-bad .lv-check-v { color: var(--c); font-weight: 700; }
.lv-check-b { padding: 0 0.8rem 0.6rem 2.2rem; font-size: 0.78rem; }
.lv-check-b p { margin: 0 0 0.3rem; }
.lv-check-fix { padding: 0.4rem 0.55rem; border-radius: 8px; background: color-mix(in srgb, var(--c) 10%, transparent); }
.lv-check-fix i { color: var(--c); }
@media (max-width: 767.98px) {
  .lv-top { grid-template-columns: auto minmax(0, 1fr); }
  .lv-figs { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lv-check summary { grid-template-columns: auto minmax(0, 1fr) auto; }
  .lv-check-v { grid-column: 2 / -1; grid-row: 2; text-align: left; }
  .lv-check-b { padding-left: 0.8rem; }
}

/* ── Lotes y Reportes: lectura y respuestas de los envíos masivos ── */
.bt-eng { display: flex; gap: 0.6rem; font-size: 0.7rem; color: var(--bt-mute); margin-top: 0.1rem; }
.bt-eng span { display: inline-flex; align-items: center; gap: 0.2rem; white-space: nowrap; }
.bt-eng span.has { color: var(--bt-warn); font-weight: 700; }
.bd-eng { margin-bottom: 0.9rem; }
.bd-eng-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: center; }
.bd-funnel { display: flex; flex-direction: column; gap: 0.45rem; }
.bd-funnel-row { --tone: var(--bt-brand); display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) 5.5rem; gap: 0.6rem; align-items: center; font-size: 0.8rem; color: var(--bt-ink); }
.bd-funnel-row.is-ok { --tone: var(--bt-ok); } .bd-funnel-row.is-info { --tone: #2f7fd1; } .bd-funnel-row.is-warn { --tone: var(--bt-warn); }
html[data-bs-theme="dark"] .bd-funnel-row.is-info { --tone: #6fb0f2; }
.bd-funnel-bar { height: 10px; border-radius: 999px; background: var(--bt-soft); overflow: hidden; }
.bd-funnel-bar span { display: block; height: 100%; border-radius: inherit; background: var(--tone); min-width: 2px; }
.bd-funnel-v { text-align: right; font-variant-numeric: tabular-nums; }
.bd-funnel-v small { color: var(--bt-mute); margin-left: 0.2rem; }
.bd-link { border: 0; background: none; padding: 0; color: var(--bt-brand); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: inherit; }
.bd-eng-side { display: flex; flex-direction: column; gap: 0.6rem; }
.bd-eng-fig b { display: block; font-size: 1.35rem; font-weight: 800; color: var(--bt-ink); line-height: 1.1; }
.bd-eng-fig span { font-size: 0.74rem; color: var(--bt-mute); }
.bd-eng-hint, .bd-eng-note { margin: 0; font-size: 0.78rem; color: var(--bt-ink); }
.bd-eng-hint i, .bd-eng-note i { color: var(--bt-brand); }
.bd-kinds { border-top: 1px dashed var(--bt-line); margin-top: 0.8rem; padding-top: 0.7rem; }
.bd-kinds h6 { font-size: 0.78rem; font-weight: 800; color: var(--bt-mute); text-transform: uppercase; letter-spacing: 0.03em; margin: 0 0 0.45rem; }
.bd-kinds ul { list-style: none; margin: 0 0 0.5rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.bd-kinds li { --tone: var(--bt-mute); display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; padding: 0.2rem 0.6rem; border-radius: 999px;
  color: var(--bt-ink); background: color-mix(in srgb, var(--tone) 11%, transparent); border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent); }
.bd-kinds li i { color: var(--tone); }
.bd-kinds li b { color: var(--tone); }
.bd-read { min-width: 11rem; max-width: 20rem; }
.bd-ack { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.72rem; color: var(--bt-mute); white-space: nowrap; }
.bd-ack.is-read { color: #2f7fd1; font-weight: 700; }
html[data-bs-theme="dark"] .bd-ack.is-read { color: #6fb0f2; }
.bd-reply { --tone: var(--bt-mute); display: block; margin-top: 0.25rem; padding: 0.3rem 0.5rem; border-radius: 8px; text-decoration: none;
  background: color-mix(in srgb, var(--tone) 9%, transparent); border-left: 3px solid var(--tone); color: var(--bt-ink); font-size: 0.76rem; }
.bd-reply:hover { background: color-mix(in srgb, var(--tone) 15%, transparent); color: var(--bt-ink); }
.bd-reply-k { display: flex; align-items: center; gap: 0.25rem; font-weight: 700; color: var(--tone); font-size: 0.7rem; }
.bd-reply-t { display: block; overflow-wrap: anywhere; }
.bd-reply small { color: var(--bt-mute); font-size: 0.66rem; }
.bt-chip.is-eng { border-style: dashed; }
/* Después de .bd-reply / .bd-kinds li para ganarles el color de cada tipo. */
.batch-detail .k-pagado { --tone: var(--bt-ok); } .batch-detail .k-comprobante { --tone: #2f7fd1; } .batch-detail .k-no_puede { --tone: var(--bt-warn); }
.batch-detail .k-consulta { --tone: var(--bt-brand); } .batch-detail .k-baja { --tone: var(--bt-danger); } .batch-detail .k-otro { --tone: var(--bt-mute); }
html[data-bs-theme="dark"] .batch-detail .k-comprobante { --tone: #6fb0f2; }
.batch-detail .bd-table a.bd-reply, .batch-detail .bd-table a.bd-reply:hover { color: var(--bt-ink); font-weight: 400; }
@media (max-width: 767.98px) {
  .bd-eng-grid { grid-template-columns: minmax(0, 1fr); }
  .bd-funnel-row { grid-template-columns: 6.5rem minmax(0, 1fr) 4.5rem; }
}
.ma-rate { display: grid; grid-template-columns: minmax(4rem, 1fr) 2.6rem 2.5rem; gap: 0.45rem; align-items: center; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.ma-rate small { color: var(--ma-mute); }
.ma-rate-bar { --tone: var(--ma-brand); height: 8px; border-radius: 999px; background: var(--ma-soft); overflow: hidden; }
.ma-rate-bar.is-ok { --tone: #0f7b55; } .ma-rate-bar.is-info { --tone: #2f7fd1; } .ma-rate-bar.is-warn { --tone: #b45309; }
html[data-bs-theme="dark"] .ma-rate-bar.is-ok { --tone: #5fd3a6; } html[data-bs-theme="dark"] .ma-rate-bar.is-info { --tone: #6fb0f2; } html[data-bs-theme="dark"] .ma-rate-bar.is-warn { --tone: #f3b25f; }
.ma-rate-bar span { display: block; height: 100%; background: var(--tone); border-radius: inherit; }
.ma-tipos td { font-size: 0.82rem; }
@media (max-width: 1199.98px) { .ab-kpis.ma-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .ab-kpis.ma-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Anti-Baneo: semáforo en la tarjeta y detalle de la línea ── */
.ab-verdict { --tone: var(--ab-ok); --tone-soft: var(--ab-ok-soft); border-radius: 10px; padding: 0.55rem 0.75rem; background: var(--tone-soft); border-left: 3px solid var(--tone); font-size: 0.8rem; }
.ab-verdict.ab-v-yellow { --tone: var(--ab-warn); --tone-soft: var(--ab-warn-soft); }
.ab-verdict.ab-v-red { --tone: var(--ab-danger); --tone-soft: var(--ab-danger-soft); }
.ab-verdict-t { font-weight: 800; color: var(--tone); }
.ab-verdict ul { margin: 0.2rem 0 0; padding-left: 1.05rem; color: var(--esam-ink); }
.ab-verdict-a { margin: 0.3rem 0 0; color: var(--esam-ink); }
.ab-verdict-a i { color: var(--tone); }
.ab-verdict-link { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.35rem; font-weight: 700; color: var(--ab-brand); text-decoration: none; }
.ab-verdict-link:hover { text-decoration: underline; }
.ab-note-phone { --tone: var(--ab-info); --tone-soft: var(--ab-info-soft); }
.ab-line-head { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.ab-line-head h5 { margin: 0; font-weight: 800; color: var(--esam-ink); }
.ab-line-head span { font-size: 0.8rem; color: var(--esam-muted); }
.ab-line-detail .lv-card { margin-bottom: 0; }
.ab-line-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.ab-q-card { border-left: 4px solid var(--ab-danger) !important; }
.ab-q-card.is-ready { border-left-color: var(--ab-ok) !important; }
.ab-card-title h5 i { color: var(--ab-brand); }
.ab-q-card .ab-card-title h5 i { color: var(--ab-danger); }
.ab-q-advice { display: flex; gap: 0.4rem; align-items: flex-start; font-size: 0.84rem; padding: 0.55rem 0.7rem; border-radius: 10px; color: var(--esam-ink); background: var(--tone-soft); }
.ab-q-advice i { color: var(--tone); font-size: 1.05rem; }
.ab-tips { margin: 0; padding-left: 1.1rem; font-size: 0.84rem; display: flex; flex-direction: column; gap: 0.4rem; color: var(--esam-ink); }

/* ── Conexión: ayuda, líneas del sistema y datos técnicos ── */
.cx-help { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; margin: 1rem 0; }
.cx-help-col { background: var(--vz-card-bg, #fff); border: 1px solid var(--vz-border-color, #e6ebf1); border-radius: 14px; padding: 0.9rem 1rem; }
html[data-bs-theme="dark"] .cx-help-col { background: #1d2125; border-color: #2a2f34; }
.cx-help-col h6 { font-weight: 800; font-size: 0.9rem; margin: 0 0 0.6rem; display: flex; gap: 0.4rem; align-items: center; }
.cx-help-col h6 i { color: var(--esam-brand, #045474); }
html[data-bs-theme="dark"] .cx-help-col h6 i { color: #6cc3e3; }
.cx-faq { border-top: 1px solid var(--vz-border-color, #e6ebf1); }
html[data-bs-theme="dark"] .cx-faq { border-color: #2a2f34; }
.cx-faq summary { display: flex; gap: 0.5rem; align-items: center; padding: 0.5rem 0.1rem; cursor: pointer; list-style: none; font-size: 0.84rem; font-weight: 600; }
.cx-faq summary::-webkit-details-marker { display: none; }
.cx-faq summary::after { content: '+'; margin-left: auto; color: var(--esam-muted, #6b7280); font-weight: 700; }
.cx-faq[open] summary::after { content: '–'; }
.cx-faq summary i { color: var(--esam-muted, #6b7280); }
.cx-faq p { margin: 0 0 0.6rem 1.6rem; font-size: 0.8rem; color: var(--esam-ink-soft, #4b5563); }
.cx-tips ul { margin: 0; padding-left: 1.1rem; font-size: 0.82rem; display: flex; flex-direction: column; gap: 0.4rem; }
.cx-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 0.75rem; align-items: center; padding: 0.75rem 0.2rem; color: inherit; text-decoration: none; }
.cx-line:hover { background: color-mix(in srgb, var(--esam-brand, #045474) 5%, transparent); }
.cx-line-dot { width: 12px; height: 12px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 22%, transparent); }
.cx-line-dot.lv-yellow { background: #f59e0b; box-shadow: 0 0 0 3px color-mix(in srgb, #f59e0b 22%, transparent); }
.cx-line-dot.lv-red { background: #ef4444; box-shadow: 0 0 0 3px color-mix(in srgb, #ef4444 22%, transparent); }
.cx-line-main { display: flex; flex-direction: column; min-width: 0; }
.cx-line-main small { color: var(--esam-muted, #6b7280); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-line-state { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; }
.cx-line-lv { font-size: 0.7rem; font-weight: 700; }
.lv-t-green { color: #0e9f6e; } .lv-t-yellow { color: #d97706; } .lv-t-red { color: #dc3545; }
.cx-tech { margin: 0; }
.cx-tech > summary { cursor: pointer; list-style: none; font-weight: 700; display: flex; gap: 0.4rem; align-items: center; }
.cx-tech > summary::-webkit-details-marker { display: none; }
@media (max-width: 991.98px) { .cx-help { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 575.98px) { .cx-line { grid-template-columns: auto minmax(0, 1fr) auto; } .cx-line-state { display: none; } }

/* ── Conversaciones: estado de la atención y responsable ── */
.cl-state { display: flex; gap: 0.3rem; overflow-x: auto; padding: 0 0.75rem 0.5rem; scrollbar-width: none; }
.cl-state::-webkit-scrollbar { display: none; }
.cl-st { flex-shrink: 0; border: 1px solid var(--vz-border-color, #e3e6eb); background: var(--vz-card-bg, #fff); color: var(--esam-ink-soft, #4b5563);
  font-size: 0.74rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; white-space: nowrap; }
.cl-st b { font-weight: 700; margin-left: 0.15rem; color: var(--esam-brand, #045474); }
.cl-st b:empty { display: none; }
.cl-st.on { background: color-mix(in srgb, var(--esam-brand, #045474) 12%, transparent); border-color: transparent; color: var(--esam-brand, #045474); }
html[data-bs-theme="dark"] .cl-st { background: #1a1c1f; border-color: #2a2d31; color: #c9ced6; }
html[data-bs-theme="dark"] .cl-st.on, html[data-bs-theme="dark"] .cl-st b { color: #6cc3e3; }
.convo-state { font-size: 0.68rem; font-weight: 700; padding: 0 0.45rem; border-radius: 999px; }
.convo-state.is-pending { color: #b45309; background: color-mix(in srgb, #b45309 12%, transparent); }
.convo-state.is-closed { color: #0f7b55; background: color-mix(in srgb, #0f7b55 12%, transparent); }
.convo-agent { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.7rem; color: var(--esam-ink-soft, #4b5563); }
.chat-state-ctl { display: flex; gap: 0.35rem; }
.chat-state-ctl .form-select { width: auto; max-width: 11rem; font-size: 0.78rem; padding-top: 0.2rem; padding-bottom: 0.2rem; }
@media (max-width: 767.98px) { .chat-state-ctl #chat-assign { display: none; } .chat-state-ctl .form-select { max-width: 8rem; } }

/* ── Lote › Volver a escribir ── */
.bd-followup { margin-bottom: 0.9rem; }
.bd-followup > summary { cursor: pointer; list-style: none; margin-bottom: 0; }
.bd-followup > summary::-webkit-details-marker { display: none; }
.bd-followup[open] > summary { margin-bottom: 0.65rem; }
.bd-fu-form { display: flex; flex-direction: column; gap: 0.6rem; }
.bd-fu-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.bd-fu-row label, .bd-fu-text { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; font-weight: 600; color: var(--bt-ink); }
.bd-fu-row label { flex: 1 1 12rem; }
.bd-fu-form .btn { align-self: flex-start; }

/* ── Semáforo: línea sin conexión (gris, no es un riesgo de bloqueo) ── */
.lv-card.lv-off { --lv: #64748b; }
.lv-off .lv-light span { opacity: 0.18; box-shadow: none; }
.cx-line-dot.lv-off { background: #94a3b8; box-shadow: 0 0 0 3px color-mix(in srgb, #94a3b8 22%, transparent); }
.lv-t-off { color: #64748b; }
.ab-session.ab-h-off { border-top-color: var(--ab-mute); }
.ab-verdict.ab-v-off { --tone: var(--ab-mute); --tone-soft: var(--ab-mute-soft); }
.ab-page .ab-mute { --tone: var(--ab-mute); --tone-soft: var(--ab-mute-soft); }
.ab-fails { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.ab-fails li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.5rem; align-items: start; font-size: 0.8rem; }
.ab-fails li > i { margin-top: 2px; }
.ab-fails .ab-fail-err { color: var(--esam-muted); overflow-wrap: anywhere; }
.ab-fails time { color: var(--esam-muted); font-size: 0.72rem; white-space: nowrap; }
.ab-resume { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; margin: 0.6rem 0; }
.ab-t-mute { color: var(--ab-mute); }
