@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ===== Tokens (alineados al prototipo DOKTRINO.travels) ===== */
:root {
  --radius: 0.875rem;
  --background: oklch(0.985 0.003 280);
  --foreground: oklch(0.2 0.04 280);
  --card: oklch(1 0 0);
  /* Azul Telepacifico (decision de Fase 1). El prototipo v3.0 usa un indigo
     var(--primary); prevalece la paleta institucional y el prototipo se ajusta. */
  --primary: oklch(0.55 0.22 237);
  --primary-deep: oklch(0.45 0.24 241);
  --primary-foreground: oklch(0.99 0.005 280);
  --primary-soft: oklch(0.96 0.025 237);
  /* Sombras y realces del primario, para no repetir el color literal. */
  --primary-shadow: oklch(0.55 0.22 237 / 0.28);
  --primary-tint: oklch(0.55 0.22 237 / 0.12);
  /* Cromo calido del prototipo v3.0: bordes, superficies suaves y texto atenuado. */
  --chrome-border: #f0ede4;
  --chrome-surface: #f4f2ea;
  --chrome-muted: #a59f8c;
  --chrome-label: #b3ab94;
  --chrome-nav: #5c5747;
  --muted: oklch(0.97 0.008 280);
  --muted-foreground: oklch(0.5 0.025 280);
  --accent-foreground: oklch(0.4 0.18 237);
  --gold: oklch(0.78 0.14 70);
  --gold-foreground: oklch(0.22 0.04 70);
  --destructive: oklch(0.6 0.22 22);
  --warning: oklch(0.74 0.16 65);
  --warning-foreground: oklch(0.22 0.05 65);
  --success: oklch(0.62 0.16 155);
  --border: oklch(0.93 0.008 280);
  --sidebar: oklch(1 0 0);
  --sidebar-border: oklch(0.94 0.008 280);
  --shadow-soft: 0 1px 2px oklch(0.4 0.15 280 / 0.04), 0 1px 3px oklch(0.4 0.15 280 / 0.05);
  --shadow-card: 0 4px 24px -8px oklch(0.4 0.15 280 / 0.10);
  --gradient-violet: linear-gradient(135deg, oklch(0.6 0.22 237), oklch(0.45 0.24 241));
}

html, body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}

a, .btn-link { color: var(--primary); }
h1, h2, h3 { letter-spacing: -0.01em; }

/* Catalogos simples de configuracion */
.cat-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.cat-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; color: var(--primary); }
.cat-title { font-size: 22px; margin: 2px 0 0; }
.cat-sub { color: var(--muted-foreground); font-size: 13px; margin: 2px 0 0; }
.cat-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; max-width: 760px; }
.cat-actions { display: flex; gap: 4px; white-space: nowrap; }
.cat-empty { color: var(--muted-foreground); font-size: 13px; padding: 12px 2px; text-align: center; }
.cat-alert { padding: 10px 14px; border-radius: 8px; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-size: 13px; margin-bottom: 12px; max-width: 760px; }

/* Modulos de configuracion (aseguradoras, roles, usuarios, pacientes...) */
.ase-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.ase-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; color: var(--primary); }
.ase-title { font-size: 22px; margin: 2px 0 0; }
.ase-alert { padding: 10px 14px; border-radius: 8px; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-size: 13px; margin-bottom: 12px; }
.ase-ok { padding: 10px 14px; border-radius: 8px; background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; font-size: 13px; margin-bottom: 12px; }
.ase-grid { display: flex; gap: 14px; align-items: flex-start; }
.ase-list { width: 300px; flex-shrink: 0; }
.ase-detail { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.ase-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.ase-card-h { font-weight: 700; font-size: 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ase-empty { color: var(--muted-foreground); font-size: 13px; padding: 12px 2px; text-align: center; }
.ase-li { display: block; width: 100%; text-align: left; border: 1px solid var(--border); border-radius: 8px; background: var(--card); padding: 8px 10px; margin-bottom: 6px; cursor: pointer; }
.ase-li:hover { border-color: var(--primary); }
.ase-li.sel { border-color: var(--primary); background: var(--primary-soft); }
.ase-li-name { font-weight: 600; font-size: 13px; color: var(--foreground); }
.ase-li-sub { font-size: 11px; color: var(--muted-foreground); }
.ase-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ase-f { display: flex; flex-direction: column; gap: 3px; }
.ase-f label { font-size: 11px; font-weight: 700; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .03em; }
.ase-f-wide { grid-column: span 2; }
.ase-f-full { grid-column: span 4; }
.ase-actions { display: flex; gap: 8px; margin-top: 12px; }
.ase-chk { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.ase-row-actions { display: flex; gap: 4px; white-space: nowrap; }
.ms-auto { margin-left: auto; }
.rol-grupo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--primary); margin: 12px 0 4px; }
.rol-table th { font-size: 11px; text-transform: uppercase; color: var(--muted-foreground); text-align: center; }
.rol-table td { text-align: center; }
.rol-table td:first-child { text-align: left; }
@media (max-width: 1100px) {
  .ase-grid { flex-direction: column; }
  .ase-list { width: 100%; }
  .ase-form { grid-template-columns: repeat(2, 1fr); }
  .ase-f-wide, .ase-f-full { grid-column: span 2; }
}

/* ===== Layout shell (prototipo v3.0: rail 64 + panel con topbar/aside/footer) ===== */
/* Altura fija: el scroll vive dentro de <main>, para que el footer quede anclado
   abajo como en el prototipo (la pagina completa no scrollea). */
.doktrino-shell { display: flex; height: 100vh; overflow: hidden; background: #faf9f5; }

/* Riel de iconos: columna fija a la izquierda, siempre visible. */
.doktrino-rail {
  width: 64px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--chrome-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.doktrino-rail-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  background: #f3f1ea; border: 0;
  display: flex; align-items: center; justify-content: center;
  color: #7a8094; font-size: 16px; font-weight: 700;
  margin-bottom: 12px; cursor: pointer;
}
.doktrino-rail-item {
  position: relative;
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; margin-bottom: 2px;
  background: transparent; color: #a7adbf; text-decoration: none;
}
.doktrino-rail-item.active {
  background: var(--primary); color: #fff;
  box-shadow: 0 6px 16px var(--primary-shadow);
}
.doktrino-rail-item svg { width: 19px; height: 19px; }

/* Tooltip del riel (titulo + descripcion), igual que el prototipo. */
.doktrino-tip {
  position: absolute; left: 52px; top: 50%;
  transform: translateY(-50%) translateX(-6px);
  background: #161c2e; color: #fff;
  padding: 11px 15px; border-radius: 13px; width: 210px;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
  box-shadow: 0 14px 36px rgba(20, 28, 50, .28);
  z-index: 200; text-align: left;
}
.doktrino-tip::before {
  content: ''; position: absolute; left: -6px; top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent; border-right-color: #161c2e;
}
.doktrino-tip b { display: block; font-size: 13.5px; font-weight: 700; letter-spacing: -.2px; }
.doktrino-tip span { display: block; margin-top: 3px; font-size: 11.5px; line-height: 1.45; font-weight: 500; color: #aab2c8; }
.doktrino-rail-item:hover .doktrino-tip { opacity: 1; visibility: visible; transform: translateY(-50%) translateX(0); }

/* Panel principal: topbar arriba, cuerpo (aside + main) y footer abajo. */
.doktrino-panel { flex: 1; min-width: 0; background: #fff; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.doktrino-topbar {
  padding: 15px 26px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  border-bottom: 1px solid var(--chrome-border);
}
.doktrino-topbar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.doktrino-topbar-brand:hover { text-decoration: none; }
.doktrino-topbar-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, oklch(0.62 0.19 237), var(--primary-deep));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 16px;
}
.doktrino-topbar-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 9px; background: #fff; }
.doktrino-topbar-name { font-weight: 800; font-size: 19px; color: #1f2433; letter-spacing: -.4px; }
.doktrino-topbar-logo { height: 26px; width: auto; display: block; }
.doktrino-page-title {
  font-weight: 700; font-size: 16px; color: #2a3346;
  border-left: 1px solid #ece8dd; padding-left: 18px;
}
.doktrino-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 13px; }
.doktrino-search {
  display: flex; align-items: center; gap: 9px;
  background: var(--chrome-surface); border: 0; border-radius: 22px;
  padding: 9px 16px; width: 210px; height: 38px;
  color: var(--chrome-muted); font-size: 12.5px; font-weight: 500;
  line-height: 1;
}
.doktrino-search input {
  border: 0; background: transparent; outline: none;
  width: 100%; font-size: 12.5px; font-weight: 500; color: #37415c;
}
.doktrino-search input::placeholder { color: var(--chrome-muted); }
.doktrino-help {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid oklch(0.89 0.06 237); cursor: pointer;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 11px; padding: 9px 14px; font-size: 12px; font-weight: 700;
}
.doktrino-help svg { width: 15px; height: 15px; }
.doktrino-mail {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--chrome-surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); position: relative; border: 0; cursor: pointer;
}
.doktrino-mail .dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%; background: #e5484d;
}
.doktrino-topbar-user { display: flex; align-items: center; gap: 9px; }
.doktrino-topbar-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.doktrino-topbar-user .nm { font-size: 12px; font-weight: 700; color: #2a3346; }
.doktrino-topbar-user .em { font-size: 10px; font-weight: 500; color: var(--chrome-muted); }

.doktrino-body { flex: 1; display: flex; min-height: 0; }

.doktrino-sidebar {
  width: 228px;
  flex-shrink: 0;
  padding: 20px 16px;
  border-right: 1px solid var(--chrome-border);
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.doktrino-content { flex: 1; overflow: auto; padding: 24px; background: #fff; min-width: 0; }

.doktrino-footer {
  border-top: 1px solid var(--chrome-border);
  padding: 12px 26px;
  display: flex; justify-content: space-between;
  font-size: 11.5px; font-weight: 500; line-height: 1.2;
  color: var(--chrome-muted);
}
.doktrino-footer b { color: #16a34a; }

/* Piezas del menu movil: ocultas en escritorio. */
.doktrino-nav-toggle {
  position: absolute; width: 0; height: 0;
  opacity: 0; pointer-events: none; margin: 0;
}
.doktrino-nav-overlay { display: none; }
.doktrino-hamburger { display: none; }

/* ===== Sidebar header / brand ===== */
.doktrino-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}
/* Variante en columna: logo grande arriba, nombre debajo, lema debajo.
   Es la que usamos en el tenant para que el logo se vea completo. */
.doktrino-brand.doktrino-brand-stack {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  text-align: center;
}
.doktrino-logo {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--gradient-violet);
  display: grid; place-items: center;
  box-shadow: var(--shadow-soft);
  color: #fff;
}
/* Logo subido por el tenant: bloque ancho rectangular (~170x60) para que se
   vea completo sin recortar las proporciones del archivo. Sin gradiente. */
.doktrino-logo.doktrino-logo-wide {
  width: 100%;
  max-width: 200px;
  height: 64px;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
  box-shadow: var(--shadow-soft);
}
.doktrino-logo svg { width: 18px; height: 18px; transform: rotate(-45deg); }
/* Logo cuadrado (default): el SVG centrado en el bloque 38x38. */
.doktrino-logo img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 12px; display: block;
}
/* Logo wide del tenant: object-fit contain para no recortar la imagen. */
.doktrino-logo.doktrino-logo-wide img {
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}
.doktrino-logo:has(img):not(.doktrino-logo-wide) { background: #fff; }
.doktrino-logo:not(.doktrino-logo-wide)::after {
  content: ""; position: absolute; bottom: -2px; right: -2px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--gold); border: 2px solid var(--sidebar);
}
.doktrino-brand-text { width: 100%; }
.doktrino-brand-stack .doktrino-brand-text { text-align: center; }
.doktrino-brand-name { font-weight: 800; font-size: 15px; letter-spacing: -0.02em; line-height: 1.15; }
.doktrino-brand-name span { color: var(--primary); }
.doktrino-brand-sub { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted-foreground); font-weight: 600; margin-top: 4px; }

.doktrino-agency {
  margin: 12px 14px 4px;
  border-radius: 10px;
  background: var(--primary-soft);
  border: 1px solid oklch(0.55 0.22 237 / 0.15);
  padding: 10px 12px;
}
.doktrino-agency .lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: oklch(0.55 0.22 237 / 0.85); }
.doktrino-agency .name { font-size: 14px; font-weight: 600; }
.doktrino-agency .meta { font-size: 11px; color: var(--muted-foreground); }

/* ===== Sidebar nav ===== */
.doktrino-nav { display: flex; flex-direction: column; }
.doktrino-nav-label {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--chrome-label); padding: 18px 10px 9px;
}
/* El primer rotulo va pegado al borde superior del aside. */
.doktrino-nav-label:first-child { padding-top: 0; }
.doktrino-nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px; border-radius: 12px;
  color: var(--chrome-nav); text-decoration: none;
  font-size: 12.5px; font-weight: 600; line-height: 1.2;
  margin-bottom: 3px; cursor: pointer;
  transition: background .12s, color .12s;
}
.doktrino-nav-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.doktrino-nav-link:hover { background: var(--chrome-surface); }
.doktrino-nav-link.active { color: var(--primary); font-weight: 700; background: transparent; }
.doktrino-nav-badge { margin-left: auto; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 7px; background: var(--primary-shadow); color: var(--primary); }

/* ===== Drawer de Ayuda / Formacion (boton Ayuda de la barra superior) =====
   Abre con el checkbox #doktrino-help-toggle: el layout es SSR estatico y no
   puede depender de @onclick de Blazor. */
/* Oculto pero renderizado: con display:none el navegador no reenvia el click del
   <label> al control, y el drawer no abriria. */
.doktrino-help-toggle {
  position: absolute; width: 0; height: 0;
  opacity: 0; pointer-events: none; margin: 0;
}
.doktrino-drawer-scrim {
  position: fixed; inset: 0; z-index: 1900;
  background: rgba(20, 26, 44, .45);
  display: none; border: 0;
}
.doktrino-help-toggle:checked ~ .doktrino-drawer-scrim { display: block; }
.doktrino-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 440px; max-width: 92vw; z-index: 1950;
  background: #fff; box-shadow: -12px 0 40px rgba(20, 28, 50, .22);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s ease;
}
.doktrino-help-toggle:checked ~ .doktrino-drawer { transform: translateX(0); }
.doktrino-help { cursor: pointer; }
.doktrino-drawer-head { background: linear-gradient(135deg, var(--primary-deep), var(--primary)); color: #fff; padding: 20px 22px; }
.doktrino-drawer-head .row1 { display: flex; align-items: center; }
.doktrino-drawer-head .ttl { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.doktrino-drawer-head .cls { margin-left: auto; cursor: pointer; font-size: 20px; color: oklch(0.88 0.05 237); background: none; border: 0; line-height: 1; user-select: none; }
.doktrino-drawer-head .sub { font-size: 13px; font-weight: 600; color: oklch(0.93 0.03 237); margin-top: 8px; }
.doktrino-drawer-head .txt { font-size: 12px; line-height: 1.5; color: oklch(0.85 0.06 237); margin-top: 4px; }
.doktrino-drawer-body { flex: 1; overflow: auto; padding: 20px 22px; }
.doktrino-drawer-body .lbl { font-size: 12px; font-weight: 700; color: #6b7488; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 11px; }
.doktrino-drawer-empty { font-size: 12.5px; line-height: 1.6; color: #8a93a8; margin: 0; }

/* ===== Tarjeta de tenant al pie del sidebar ===== */
.doktrino-tenant-card {
  margin-top: auto;
  background: var(--chrome-surface);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
}
.doktrino-tenant-card .nm { font-size: 12px; font-weight: 700; color: #2a3346; }
.doktrino-tenant-card .mt { font-size: 10px; font-weight: 500; color: var(--chrome-muted); margin-top: 2px; }
.doktrino-user-chip strong { color: var(--foreground); font-weight: 600; }

/* ===== Page header ===== */
.page-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em; color: var(--primary); }
.page-title { font-size: 1.7rem; font-weight: 800; margin: 4px 0 2px; }
.page-title span { color: var(--primary); }
.page-sub { font-size: 0.9rem; color: var(--muted-foreground); margin-bottom: 22px; }

/* ===== KPI cards ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; max-width: 1000px; }
.kpi-card { background: var(--card); border: 1px solid var(--border); border-radius: 1.25rem; padding: 18px 20px; box-shadow: var(--shadow-soft); }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; }
.kpi-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-icon.tone-primary { background: var(--primary-soft); color: var(--primary); }
.kpi-icon.tone-gold { background: oklch(0.78 0.14 70 / 0.16); color: var(--gold-foreground); }
.kpi-icon.tone-success { background: oklch(0.62 0.16 155 / 0.15); color: var(--success); }
.kpi-icon.tone-danger { background: oklch(0.6 0.22 22 / 0.10); color: var(--destructive); }
.kpi-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-foreground); font-weight: 700; margin-top: 14px; }
.kpi-value { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-hint { font-size: 11px; color: var(--muted-foreground); }

/* ===== Cards (override bootstrap) ===== */
.card { border: 1px solid var(--border); border-radius: 1.1rem; box-shadow: var(--shadow-card); }
.card-title { font-weight: 700; letter-spacing: -0.01em; }

/* ===== Buttons (override bootstrap) ===== */
.btn { border-radius: 0.6rem; font-weight: 600; font-size: 0.875rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover, .btn-primary:focus { background: oklch(0.5 0.22 237); border-color: oklch(0.5 0.22 237); color: #fff; }
.btn-outline-secondary { color: var(--foreground); border-color: var(--border); background: var(--card); }
.btn-outline-secondary:hover { background: var(--muted); color: var(--foreground); }
.btn-outline-success { color: var(--success); border-color: oklch(0.62 0.16 155 / 0.5); }
.btn-outline-success:hover { background: var(--success); color: #fff; }
.btn-outline-danger { color: var(--destructive); border-color: oklch(0.6 0.22 22 / 0.5); }
.btn-outline-danger:hover { background: var(--destructive); color: #fff; }
.btn:focus, .btn:active:focus, .form-control:focus { box-shadow: 0 0 0 3px oklch(0.55 0.22 237 / 0.25); }

/* ===== Forms (override bootstrap) ===== */
.form-control { border-radius: 0.55rem; border-color: var(--border); font-size: 0.9rem; }
.form-control:focus { border-color: var(--primary); }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--muted-foreground); }

/* ===== Tables (override bootstrap) ===== */
.table { --bs-table-bg: transparent; color: var(--foreground); }
.table > thead th { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-foreground); font-weight: 700; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.table > tbody td { border-bottom: 1px solid var(--border); padding: 12px 8px; vertical-align: middle; }
.table.table-hover > tbody > tr:hover > * { background: var(--muted); }

/* ===== Badges (override bootstrap bg-*) ===== */
.badge { font-weight: 700; font-size: 10.5px; padding: 4px 9px; border-radius: 7px; letter-spacing: 0.02em; }
.badge.bg-success { background: oklch(0.62 0.16 155 / 0.15) !important; color: var(--success) !important; }
.badge.bg-info { background: var(--primary-soft) !important; color: var(--primary) !important; }
.badge.bg-danger { background: oklch(0.6 0.22 22 / 0.12) !important; color: var(--destructive) !important; }
.badge.bg-warning { background: oklch(0.78 0.14 70 / 0.18) !important; color: var(--warning-foreground) !important; }
.badge.bg-secondary { background: var(--muted) !important; color: var(--muted-foreground) !important; }

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

/* ===== Login ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background:
  radial-gradient(1200px 600px at 50% -10%, oklch(0.93 0.05 237), transparent), var(--background); }
.login-card { width: 380px; background: var(--card); padding: 34px; border-radius: 1.25rem; box-shadow: var(--shadow-card); border: 1px solid var(--border); }
.login-logo { width: 48px; height: 48px; border-radius: 14px; background: var(--gradient-violet); display: grid; place-items: center; color: #fff; margin-bottom: 16px; }
.login-logo svg { width: 22px; height: 22px; transform: rotate(-45deg); }
.login-title { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.login-title span { color: var(--primary); }

/* ===== Auth (login + registro autogestion, diseno de dos paneles) ===== */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: #fff; }
@media (max-width: 900px) { .auth-shell { grid-template-columns: 1fr; } .auth-aside { display: none !important; } }

/* Panel izquierdo azul de la marca */
.auth-aside { position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(-45deg, #0277bd, #0288d1, #039be5, #01579b); background-size: 300% 300%; animation: authGradient 14s ease infinite; }
@keyframes authGradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.auth-aside-deco { position: absolute; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.16), transparent 65%); pointer-events: none; }
.auth-deco-tr { top: -60px; right: -60px; }
.auth-deco-bl { bottom: -60px; left: -60px; }
.auth-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-brand-logo { width: 46px; height: 46px; border-radius: 13px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); display: grid; place-items: center; backdrop-filter: blur(6px); }
.auth-brand-logo svg { width: 22px; height: 22px; transform: rotate(-45deg); }
.auth-brand-logo-img { height: 34px; max-width: 230px; object-fit: contain; }
.auth-brand-name { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; }
.auth-aside-body { position: relative; z-index: 1; max-width: 420px; }
.auth-aside-body h2 { font-size: 2.9rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 16px; }
.auth-aside-body p { font-size: 1rem; line-height: 1.6; color: rgba(255,255,255,.9); margin: 0 0 22px; }
/* Mascota del login: se asoma por el borde derecho del panel (overflow:hidden
   del aside la recorta, de ahi el efecto "detras del panel"). Entra deslizando
   desde la derecha al cargar. */
.auth-mascota { position: absolute; z-index: 1; right: -40px; top: 0; bottom: 0; margin: auto 0;
                width: min(50%, 390px); height: auto; pointer-events: none;
                filter: drop-shadow(-14px 18px 34px rgba(0,0,0,.32));
                animation: authMascotaSale .9s cubic-bezier(.22,1,.36,1) .15s both; }
@keyframes authMascotaSale {
  from { opacity: 0; transform: translateX(70px) rotate(6deg); }
  to   { opacity: 1; transform: translateX(0) rotate(0); }
}
@media (prefers-reduced-motion: reduce) { .auth-mascota { animation: none; } }
/* Franja mas oscura tras la mascota, como en la referencia. */
.auth-aside::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0;
  width: 120px; background: rgba(1,45,90,.28); pointer-events: none; z-index: 0; }
@media (max-width: 1100px) { .auth-mascota { display: none; } .auth-aside::after { display: none; } }

.auth-dots { display: flex; gap: 8px; }
.auth-dots span { width: 8px; height: 8px; border-radius: 99px; background: rgba(255,255,255,.45); }
.auth-dots span:first-child { width: 22px; background: #fff; }

/* Panel derecho formularios */
.auth-main { display: flex; flex-direction: column; padding: 40px clamp(24px, 6vw, 80px); }
.auth-form-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 440px; width: 100%; margin: 0 auto; }
.auth-pane-signup { display: none; }
.auth-shell.is-signup .auth-pane-login { display: none; }
.auth-shell.is-signup .auth-pane-signup { display: block; }
.auth-head { margin-bottom: 26px; }
.auth-head h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; color: var(--foreground); margin: 0 0 6px; }
.auth-head p { font-size: .92rem; color: var(--muted-foreground); margin: 0; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); }
.auth-field input { width: 100%; padding: 13px 15px; border-radius: 12px; border: 1px solid var(--border); background: var(--background); font-size: .95rem; transition: border-color .15s, box-shadow .15s; }
.auth-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px oklch(0.62 0.2 237 / .15); background: #fff; }
.auth-select { width: 100%; padding: 13px 15px; border-radius: 12px; border: 1px solid var(--border); background: var(--background); font-size: .95rem; transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 40px; }
.auth-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px oklch(0.62 0.2 237 / .15); background-color: #fff; }
.auth-input-icon { position: relative; }
.auth-input-icon input { padding-right: 78px; }
.auth-eye { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: .68rem; font-weight: 700; letter-spacing: .04em; color: var(--muted-foreground); cursor: pointer; }
.auth-eye:hover { color: var(--primary); }
.auth-submit { margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px; border: none; border-radius: 12px; background: var(--gradient-violet, #0288d1); color: #fff; font-size: .98rem; font-weight: 700; cursor: pointer; box-shadow: 0 10px 24px -10px rgba(2,136,209,.6); transition: transform .12s, box-shadow .15s; }
.auth-submit:hover { box-shadow: 0 14px 30px -10px rgba(2,136,209,.7); }
.auth-submit:active { transform: scale(.99); }
.auth-submit svg { width: 16px; height: 16px; }
.auth-switch { margin-top: 24px; text-align: center; font-size: .9rem; color: var(--muted-foreground); }
.auth-switch button { background: none; border: none; color: var(--primary); font-weight: 700; cursor: pointer; margin-left: 4px; }
.auth-switch button:hover { text-decoration: underline; }
.auth-alert { padding: 11px 14px; border-radius: 10px; font-size: .88rem; margin-bottom: 18px; }
.auth-alert-error { background: oklch(0.95 0.04 25); color: oklch(0.5 0.2 25); border: 1px solid oklch(0.85 0.08 25); }
.auth-alert-ok { background: oklch(0.95 0.05 150); color: oklch(0.45 0.13 150); border: 1px solid oklch(0.85 0.09 150); }
.auth-label-row { display: flex; justify-content: space-between; align-items: center; }
/* Casilla "recordar usuario" del login. */
.auth-remember {
  display: flex; align-items: center; gap: 9px;
  margin-top: 14px; cursor: pointer;
  font-size: .82rem; font-weight: 500; color: var(--muted-foreground);
  user-select: none;
}
.auth-remember input {
  width: 17px; height: 17px; flex-shrink: 0;
  accent-color: var(--primary); cursor: pointer; margin: 0;
}
.auth-remember:hover span { color: var(--foreground); }

.auth-forgot { font-size: .72rem; font-weight: 700; color: var(--primary); text-decoration: none; }
.auth-forgot:hover { text-decoration: underline; }
.auth-legal { font-size: .76rem; line-height: 1.5; color: var(--muted-foreground); margin: 2px 0 0; }
.auth-footer { text-align: center; font-size: .76rem; color: var(--muted-foreground); padding-top: 24px; border-top: 1px solid var(--border); margin-top: 24px; }
.auth-providers { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 18px; }
.auth-provider { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--background); font-size: .9rem; font-weight: 600; color: var(--foreground); cursor: pointer; }
.auth-provider[disabled] { opacity: .65; cursor: not-allowed; }
.auth-provider small { font-size: .68rem; color: var(--muted-foreground); font-weight: 600; }
.auth-hint { margin: -8px 0 14px; font-size: .8rem; color: #dc2626; }
.auth-input-error { border-color: #dc2626 !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.auth-divider { position: relative; text-align: center; margin: 18px 0; }
.auth-divider::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.auth-divider span { position: relative; background: #fff; padding: 0 12px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted-foreground); }

/* ===== Pagina Marca (branding super admin) ===== */
.brand-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 1000px) { .brand-cols { grid-template-columns: 1fr; } }
.brand-form { padding: 22px; }
.brand-logo-current { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 12px; border: 1px dashed var(--border); border-radius: 12px; }
.brand-logo-current img { height: 46px; max-width: 200px; object-fit: contain; }
.brand-preview { position: relative; }
.brand-preview-aside { border-radius: 16px; overflow: hidden; color: #fff; padding: 32px; min-height: 320px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(-45deg, #0277bd, #0288d1, #039be5, #01579b); background-size: 300% 300%; animation: authGradient 14s ease infinite; }
.bp-brand { display: flex; align-items: center; gap: 10px; }
.bp-brand img { height: 40px; max-width: 160px; object-fit: contain; background: rgba(255,255,255,.92); padding: 5px 9px; border-radius: 9px; }
.bp-logo { width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); display: grid; place-items: center; }
.bp-logo svg { width: 19px; height: 19px; transform: rotate(-45deg); }
.bp-brand span { font-size: 1.2rem; font-weight: 800; }
.bp-body h3 { font-size: 1.6rem; font-weight: 800; line-height: 1.15; margin: 0 0 10px; }
.bp-body p { font-size: .92rem; line-height: 1.55; color: rgba(255,255,255,.9); margin: 0; }
.brand-preview-label { text-align: center; font-size: .76rem; color: var(--muted-foreground); margin-top: 10px; }
.brand-suggested { display: flex; gap: 10px; flex-wrap: wrap; }
.brand-suggested-item { padding: 8px; border: 2px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; }
.brand-suggested-item.active { border-color: var(--primary); box-shadow: 0 0 0 3px oklch(0.62 0.2 237 / .15); }
.brand-suggested-item img { height: 40px; max-width: 130px; object-fit: contain; display: block; }

/* error boundary (keep functional) */
.blazor-error-boundary { background: var(--destructive); padding: 1rem; color: white; border-radius: 8px; }
.blazor-error-boundary::after { content: "Ha ocurrido un error."; }
.validation-message { color: var(--destructive); }

/* ===== Module header (icono + eyebrow + titulo + acciones), estilo prototipo ===== */
.module-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.module-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.module-icon svg { width: 19px; height: 19px; }
.module-eyebrow { display: flex; align-items: center; gap: 10px; }
.module-eyebrow span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.18em; color: var(--primary); }

/* ===== Plan cards (estilo prototipo) ===== */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; max-width: 1100px; }
.plan-card { background: var(--card); border: 1px solid var(--border); border-radius: 1.25rem; box-shadow: var(--shadow-soft); padding: 24px; display: flex; flex-direction: column; }
.plan-card.featured { border-color: oklch(0.55 0.22 237 / 0.4); box-shadow: 0 0 0 1px oklch(0.55 0.22 237 / 0.3), var(--shadow-card); }
.plan-card.gold { border-color: oklch(0.78 0.14 70 / 0.45); }
.plan-card .pname { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-foreground); font-weight: 700; }
.plan-card .pprice { font-size: 1.9rem; font-weight: 800; line-height: 1.15; margin-top: 4px; }
.plan-card .pprice small { font-size: 0.85rem; font-weight: 600; color: var(--muted-foreground); }
.plan-features { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 9px; font-size: 0.9rem; }
.plan-features li { display: flex; align-items: center; gap: 8px; }
.plan-check { width: 16px; height: 16px; color: var(--success); flex-shrink: 0; }
.plan-edit { margin-top: 22px; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: oklch(0.2 0.04 280 / 0.45); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 50; padding: 20px; }
/* pointer-events:auto anula el .modal-dialog de Bootstrap (que lo pone en none para
   dejar pasar el clic al backdrop); sin esto no se puede enfocar/escribir en los inputs. */
.modal-dialog { pointer-events: auto; background: var(--card); border-radius: 1.1rem; box-shadow: 0 16px 40px -12px oklch(0.42 0.22 237 / 0.28); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.modal-close { display: grid; place-items: center; width: 34px; height: 34px; margin: -6px -6px -6px 0; border-radius: 0.6rem; background: none; border: none; font-size: 1.4rem; color: var(--muted-foreground); cursor: pointer; line-height: 1; transition: background .15s, color .15s; }
.modal-close:hover { background: var(--muted); color: var(--foreground); }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px; border-top: 1px solid var(--border); }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== Placeholder "Proximamente" ===== */
.coming-soon { max-width: 1040px; border: 1px dashed var(--border); border-radius: 1.25rem; background: var(--card); padding: 56px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.coming-soon-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: 16px; }
.coming-soon-icon svg { width: 26px; height: 26px; }
.coming-soon h3 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.coming-soon p { font-size: 0.9rem; color: var(--muted-foreground); margin: 6px 0 0; max-width: 420px; }

/* ===== Pares etiqueta/valor (config Wompi) ===== */
.wlbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-foreground); font-weight: 700; }
.wval { font-size: 0.92rem; font-weight: 600; margin-top: 2px; margin-bottom: 4px; }

/* ===== Mi cuenta (tenant) ===== */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; max-width: 1040px; }
.acct-logo { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; border: 1px solid var(--border); background: var(--card); flex-shrink: 0; }
.acct-logo-empty { display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; color: var(--primary); background: var(--primary-soft); }

/* ===== Pipeline Kanban ===== */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kb-col { flex: 0 0 270px; background: var(--muted); border: 1px solid var(--border); border-radius: 1rem; display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.kb-col.drop-hover { outline: 2px dashed var(--primary); outline-offset: -2px; }
.kb-col-head { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kb-col-title { font-weight: 700; font-size: 0.92rem; }
.kb-col-meta { font-size: 11px; color: var(--muted-foreground); margin-top: 2px; }
.kb-col-count { font-size: 10px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.kb-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; flex: 1; min-height: 60px; }
.kb-card { background: var(--card); border: 1px solid var(--border); border-radius: 0.75rem; padding: 11px 12px; box-shadow: var(--shadow-soft); cursor: pointer; }
.kb-card:hover { border-color: oklch(0.55 0.22 237 / 0.4); }
.kb-card .nm { font-weight: 700; font-size: 0.9rem; }
.kb-card .meta { font-size: 11.5px; color: var(--muted-foreground); margin-top: 3px; }
.kb-card .val { font-weight: 700; font-size: 0.92rem; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kb-card .ase { width: 22px; height: 22px; border-radius: 50%; background: var(--gradient-violet); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; }
.kb-cardrow { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kb-empty { font-size: 12px; color: var(--muted-foreground); text-align: center; padding: 14px 0; }

/* ===== Pipeline: tarjeta enriquecida (estilo prototipo) ===== */
.kb-card.stale { box-shadow: var(--shadow-soft), -3px 0 0 var(--destructive) inset; padding-left: 15px; border-color: oklch(0.6 0.22 22 / 0.35); }
.kb-top { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--muted-foreground); font-weight: 600; margin-bottom: 8px; gap: 8px; }
.kb-time { display: inline-flex; align-items: center; gap: 5px; }
.kb-time svg { width: 11px; height: 11px; }
.kb-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap; }
.kb-badge.stale { background: oklch(0.6 0.22 22 / 0.10); color: var(--destructive); }
.kb-badge svg { width: 10px; height: 10px; }
.kb-archive { margin-left: auto; background: none; border: none; padding: 2px; border-radius: 6px; color: var(--muted-foreground); cursor: pointer; display: inline-grid; place-items: center; opacity: 0.5; }
.kb-card:hover .kb-archive { opacity: 1; }
.kb-archive:hover { background: var(--muted); color: var(--destructive); }
.kb-archive svg { width: 14px; height: 14px; }

/* Lead con mensaje del cliente sin responder */
.kb-card.needsreply { background: oklch(0.97 0.045 50); border-color: oklch(0.72 0.16 55 / 0.55); box-shadow: var(--shadow-soft), -3px 0 0 oklch(0.7 0.17 50) inset; padding-left: 15px; }
.kb-card.needsreply:hover { border-color: oklch(0.7 0.17 50); }
.kb-badge.reply { background: oklch(0.7 0.17 50 / 0.16); color: oklch(0.5 0.16 45); }
.kb-unread { display: inline-flex; align-items: center; gap: 5px; margin: 4px 0 2px; font-size: 11px; font-weight: 700; color: oklch(0.5 0.16 45); }
.kb-unread svg { width: 12px; height: 12px; }

/* Barra de busqueda + orden + filtros */
.pl-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; max-width: 840px; }
.pl-search { position: relative; flex: 1; min-width: 220px; display: flex; align-items: center; }
.pl-search svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted-foreground); }
.pl-search input { width: 100%; padding: 9px 32px 9px 36px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); font-size: 13px; }
.pl-search-clear { position: absolute; right: 8px; border: none; background: none; font-size: 18px; line-height: 1; color: var(--muted-foreground); cursor: pointer; }
.pl-sort { display: flex; align-items: center; gap: 6px; }
.pl-sort-lbl { font-size: 12px; color: var(--muted-foreground); }
.pl-sort select { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; background: var(--card); }
.btn.pl-filt-on { border-color: var(--primary); color: var(--primary); }

.pl-filt-anchor { position: relative; }
.pl-filters { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 600px; max-width: 88vw; border: 1px solid var(--border); border-radius: 12px; background: var(--card); padding: 16px 18px; box-shadow: var(--shadow-lg); }
.pl-filters-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pl-filters-head > span { font-weight: 700; font-size: 13px; }
.pl-link { border: none; background: none; color: var(--primary); font-size: 12px; cursor: pointer; }
.pl-filt-group { margin-bottom: 12px; }
.pl-filt-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--muted-foreground); margin-bottom: 7px; }
.pl-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.pl-fchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-size: 12px; cursor: pointer; color: var(--foreground); }
.pl-fchip:hover { border-color: var(--primary); }
.pl-fchip.on { background: var(--accent); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.pl-fchip .dot { width: 8px; height: 8px; border-radius: 50%; }
.pl-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

/* ===== Agentes IA ===== */
.ag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; max-width: 1040px; }
.ag-card { border: 1px solid var(--border); border-radius: 14px; background: var(--card); padding: 16px 18px; box-shadow: var(--shadow-soft); display: flex; flex-direction: column; gap: 6px; }
.ag-card-top { display: flex; align-items: center; justify-content: space-between; }
.ag-provider { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); }
.ag-provider.p-claude { background: oklch(0.95 0.05 40); color: oklch(0.5 0.16 40); }
.ag-provider.p-gemini { background: oklch(0.95 0.05 255); color: oklch(0.5 0.16 255); }
.ag-provider.p-gpt { background: oklch(0.95 0.05 160); color: oklch(0.45 0.13 160); }
.ag-name { font-weight: 700; font-size: 15px; margin-top: 4px; }
.ag-role { font-size: 12px; color: var(--muted-foreground); }
.ag-prompt { font-size: 12px; color: var(--muted-foreground); margin: 6px 0; line-height: 1.45; min-height: 34px; }
.ag-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); }
.ag-res { font-size: 11.5px; color: var(--muted-foreground); }
.ag-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.ag-switch input { opacity: 0; width: 0; height: 0; }
.ag-slider { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: .2s; cursor: pointer; }
.ag-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.ag-switch input:checked + .ag-slider { background: oklch(0.6 0.16 150); }
.ag-switch input:checked + .ag-slider::before { transform: translateX(18px); }
.ag-res-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ag-res-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); padding: 6px 6px; border-bottom: 1px solid var(--border); }
.ag-res-table td { padding: 6px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.form-control-sm { padding: 5px 8px; font-size: 12px; border: 1px solid var(--border); border-radius: 7px; width: 100%; background: var(--card); }
.ag-file { display: flex; flex-direction: column; gap: 4px; font-size: 11px; }
.ag-fileinput { font-size: 11px; }

/* ===== Automatizaciones (workflows) ===== */
.auto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; max-width: 980px; }
.auto-card { border: 1px solid var(--border); border-radius: 14px; background: var(--card); padding: 16px 18px; box-shadow: var(--shadow-soft); cursor: pointer; transition: border-color .15s; }
.auto-card:hover { border-color: oklch(0.55 0.22 237 / 0.4); }
.auto-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.auto-name { font-weight: 700; font-size: 14.5px; }
.auto-del-btn { background: transparent; border: 1px solid #fecaca; color: #b91c1c; border-radius: 6px; padding: 2px 8px; font-size: 14px; cursor: pointer; transition: background 0.15s; }
.auto-del-btn:hover { background: #fee2e2; }
.auto-del-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.auto-flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.auto-trig { background: var(--accent); color: var(--primary); border-radius: 9px; padding: 7px 11px; font-size: 12px; font-weight: 600; }
.auto-arrow { color: var(--muted-foreground); }
.auto-act { background: oklch(0.95 0.05 60); color: oklch(0.5 0.14 55); border-radius: 9px; padding: 7px 11px; font-size: 12px; font-weight: 600; }
.auto-exec { font-size: 11.5px; color: var(--muted-foreground); margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.kb-route { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px dashed var(--border); border-radius: 8px; padding: 7px 10px; margin: 10px 0; background: var(--muted); font-size: 11.5px; }
.kb-route .codes { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.kb-route .codes .arr { color: var(--muted-foreground); }
.kb-route .date { color: var(--muted-foreground); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.kb-route .date svg { width: 11px; height: 11px; flex-shrink: 0; }
.kb-comment { font-size: 12px; color: var(--muted-foreground); line-height: 1.4; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kb-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-top: 9px; border-top: 1px dashed var(--border); }
.kb-ase { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--foreground); font-weight: 600; min-width: 0; }
.kb-ase .nmtxt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-ase-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.kb-pax { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted-foreground); font-weight: 600; white-space: nowrap; }
.kb-pax svg { width: 11px; height: 11px; }

/* ===== Ficha de lead con chat (estilo prototipo) ===== */
.pl-lead-dialog { max-width: 1400px; width: 96vw; display: flex; padding: 0; overflow: hidden; max-height: 94vh; height: 94vh; }
.pl-lead-left { flex: 1 1 55%; min-width: 0; display: flex; flex-direction: column; max-height: 94vh; }
.pl-lead-left .modal-body { flex: 1; overflow-y: auto; }
.pl-chat { flex: 1 1 45%; min-width: 0; display: flex; flex-direction: column; max-height: 94vh; border-left: 1px solid var(--border); background: var(--muted); }
.pl-chat-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); background: var(--card); }
.pl-chat-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--gradient-violet); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.pl-chat-head .nm { font-weight: 700; font-size: 13px; line-height: 1.2; }
.pl-chat-head .sub { font-size: 11px; color: var(--muted-foreground); display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.pl-chat-head .sub::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #4f8a60; box-shadow: 0 0 0 2px rgba(79,138,96,0.2); }
.pl-chat-more { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--muted); font-size: 11px; color: var(--muted-foreground); cursor: default; flex-shrink: 0; }
.pl-chat-more svg { width: 12px; height: 12px; }
.pl-chat-line { margin-top: 6px; }
.pl-chat-line select { font-size: 11px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); width: 100%; }

/* Pestañas de la columna de datos del lead */
.pl-lead-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.pl-lead-tab { background: none; border: none; padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--muted-foreground); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.pl-lead-tab:hover { color: var(--foreground); }
.pl-lead-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Timeline de actividad */
.pl-timeline { display: flex; flex-direction: column; }
.pl-tl-item { display: flex; gap: 12px; padding: 4px 0; }
.pl-tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; position: relative; }
.pl-tl-item:not(:last-child) .pl-tl-dot::after { content: ''; position: absolute; left: 50%; top: 13px; transform: translateX(-50%); width: 2px; height: calc(100% + 8px); background: var(--border); }
.pl-tl-body { padding-bottom: 14px; }
.pl-tl-desc { font-size: 13px; color: var(--foreground); }
.pl-tl-meta { font-size: 11.5px; color: var(--muted-foreground); margin-top: 2px; }
.pl-tl-actor { font-weight: 600; color: var(--primary); }

/* Chips de cabecera del lead */
.pl-tags { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pl-state-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; background: var(--accent); color: var(--primary); border: 1px solid var(--border); }
.pl-state-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.pl-chip { background: var(--card); border: 1px solid var(--border); color: var(--muted-foreground); padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.pl-chip svg { width: 10px; height: 10px; }

/* Conmutador de vista Kanban / Lista */
.pl-view { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--card); }
.pl-view-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: none; background: none; color: var(--muted-foreground); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pl-view-btn + .pl-view-btn { border-left: 1px solid var(--border); }
.pl-view-btn svg { width: 15px; height: 15px; }
.pl-view-btn.on { background: var(--primary); color: #fff; }

/* Vista lista del tablero */
.pl-list { border: 1px solid var(--border); border-radius: 12px; background: var(--card); overflow: hidden; }
.pl-list-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pl-list-table th { text-align: left; padding: 11px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted-foreground); border-bottom: 1px solid var(--border); }
.pl-list-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.pl-list-table tbody tr:last-child td { border-bottom: none; }
.pl-list-table tbody tr:hover { background: var(--muted); }
.pl-list-table tr.pl-row-reply { background: color-mix(in srgb, var(--destructive) 6%, transparent); }
.pl-row-tag { margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--destructive); }

/* Filtros del modal de historial */
.pl-hist-filters { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pl-hist-table th { white-space: nowrap; }

.btn-icon { background: none; border: none; padding: 5px; border-radius: 6px; color: var(--muted-foreground); cursor: pointer; display: inline-grid; place-items: center; }
.btn-icon:hover { background: var(--muted); color: var(--destructive); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Notas de seguimiento del lead */
.pl-notes-composer { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--card); margin-bottom: 14px; }
.pl-notes-composer textarea { resize: vertical; }
.pl-notes-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.pl-notes-colors { display: flex; gap: 6px; }
.pl-note-swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.pl-note-swatch.on { border-color: var(--foreground); box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--foreground); }
.pl-notes-list { display: flex; flex-direction: column; gap: 10px; }
.pl-note { position: relative; border: 1px solid; border-radius: 10px; padding: 10px 30px 8px 12px; }
.pl-note-text { font-size: 13px; line-height: 1.45; color: #2a2a2a; white-space: pre-wrap; word-wrap: break-word; }
.pl-note-meta { margin-top: 6px; font-size: 11px; color: rgba(0,0,0,0.5); font-weight: 600; }
.pl-note-del { position: absolute; top: 6px; right: 8px; border: none; background: none; font-size: 17px; line-height: 1; color: rgba(0,0,0,0.35); cursor: pointer; }
.pl-note-del:hover { color: var(--destructive); }

/* Archivos del lead */
.pl-files-upload { margin-bottom: 14px; }
.pl-files-drop { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px; border: 1.5px dashed var(--border); border-radius: 10px; background: var(--card); color: var(--muted-foreground); font-size: 13px; font-weight: 600; cursor: pointer; }
.pl-files-drop:hover { border-color: var(--primary); color: var(--primary); }
.pl-files-drop svg { width: 18px; height: 18px; }
.pl-files-list { display: flex; flex-direction: column; gap: 8px; }
.pl-file { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; background: var(--card); }
.pl-file-ico { width: 38px; height: 38px; flex: none; border-radius: 8px; background: var(--accent); color: var(--primary); display: grid; place-items: center; font-size: 10px; font-weight: 800; letter-spacing: 0.02em; }
.pl-file-info { flex: 1; min-width: 0; }
.pl-file-name { display: block; font-size: 13px; font-weight: 600; color: var(--foreground); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-file-name:hover { color: var(--primary); text-decoration: underline; }
.pl-file-meta { font-size: 11px; color: var(--muted-foreground); margin-top: 2px; }

/* ===== Conversaciones (bandeja unificada) ===== */
.cv-warn { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; font-size: 13px; color: var(--muted-foreground); }
.cv-warn a { color: var(--primary); font-weight: 600; }
.cv-grid { display: grid; grid-template-columns: 320px 1fr 300px; gap: 16px; height: calc(100vh - 270px); min-height: 480px; }
@media (max-width: 1100px) { .cv-grid { grid-template-columns: 280px 1fr; } .cv-side-col { display: none; } }
.cv-back { display: none; }
@media (max-width: 768px) {
  /* Una sola columna a la vez: lista por defecto, hilo al elegir un chat. */
  .cv-grid { grid-template-columns: 1fr; height: auto; }
  .cv-list-col, .cv-thread-col { height: calc(100vh - 210px); min-height: 420px; }
  .cv-grid:not(.cv-has-active) .cv-thread-col { display: none; }
  .cv-grid.cv-has-active .cv-list-col { display: none; }
  .cv-back {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; flex: none; margin-left: -2px;
    border: 1px solid var(--border); border-radius: 9px; background: var(--card);
    color: var(--foreground); cursor: pointer;
  }
  .cv-back svg { width: 18px; height: 18px; }
}

.cv-list-col, .cv-thread-col, .cv-side-col { background: var(--card); border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.cv-side-col { padding: 14px; gap: 14px; overflow-y: auto; }

.cv-search { position: relative; padding: 12px; border-bottom: 1px solid var(--border); }
.cv-search svg { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-foreground); }
.cv-search input { width: 100%; height: 36px; border: 1px solid var(--border); border-radius: 9px; background: var(--muted); padding: 0 10px 0 32px; font-size: 12.5px; }

.cv-list { flex: 1; overflow-y: auto; }
.cv-empty, .cv-side-empty { padding: 18px; font-size: 12.5px; color: var(--muted-foreground); }
.cv-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border); padding: 11px 12px; cursor: pointer; }
.cv-item:hover { background: var(--muted); }
.cv-item.on { background: var(--accent); }
.cv-avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--gradient-violet, linear-gradient(135deg,#7c4dff,#a78bfa)); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.cv-avatar.lg { width: 42px; height: 42px; font-size: 13px; }
.cv-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cv-item-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.cv-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-item-time { font-size: 10px; color: var(--muted-foreground); flex: none; }
.cv-item-last { font-size: 11.5px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-item-tags { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.cv-line-tag { font-size: 9px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: var(--muted); color: var(--muted-foreground); }
.cv-unread { font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--destructive); color: #fff; display: grid; place-items: center; }

.cv-thread-empty, .cv-side-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted-foreground); font-size: 13px; text-align: center; padding: 24px; }
.cv-thread-empty svg { width: 46px; height: 46px; opacity: 0.4; }
.cv-thread-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.cv-th-name { font-size: 14px; font-weight: 700; }
.cv-th-sub { font-size: 11px; color: var(--muted-foreground); }
.cv-line-select { border: 1px solid var(--border); border-radius: 8px; font-size: 11.5px; padding: 5px 8px; background: var(--card); max-width: 150px; }
.cv-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 9px; background: var(--muted); }
.cv-composer { padding: 12px; border-top: 1px solid var(--border); }
.cv-composer-box { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--background, var(--card)); padding: 8px; }
.cv-composer-box textarea { flex: 1; border: none; background: transparent; resize: none; font-size: 13px; outline: none; max-height: 120px; }
.cv-send { width: 38px; height: 38px; flex: none; border: none; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; cursor: pointer; }
.cv-send:disabled { opacity: 0.5; cursor: not-allowed; }
.cv-send svg { width: 17px; height: 17px; }

.cv-context { border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.cv-ctx-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--muted-foreground); }
.cv-ctx-name { font-size: 15px; font-weight: 700; margin-top: 3px; }
.cv-ctx-rows { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.cv-ctx-rows > div { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.cv-ctx-rows span { color: var(--muted-foreground); }
.cv-copilot { border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.cv-copilot-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cv-bot { width: 26px; height: 26px; border-radius: 7px; background: var(--gold, #e9b949); color: #3a2c00; display: grid; place-items: center; }
.cv-bot svg { width: 15px; height: 15px; }
.cv-copilot-lbl { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--primary); }
.cv-soon { margin-left: auto; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 7px; border-radius: 999px; background: var(--muted); color: var(--muted-foreground); }
.cv-copilot-note { font-size: 11.5px; color: var(--muted-foreground); line-height: 1.5; }
.cv-copilot-note a { color: var(--primary); font-weight: 600; }
.cv-dl { display: inline-block; margin-top: 5px; font-size: 11px; font-weight: 600; text-decoration: none; opacity: 0.85; }
.pl-bubble.in .cv-dl { color: var(--primary); }
.pl-bubble.out .cv-dl { color: rgba(255,255,255,0.92); text-decoration: underline; }

/* ===== Metricas / reportes ===== */
.rep-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 900px) { .rep-grid { grid-template-columns: 1fr; } }
.rep-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.rep-card.rep-wide { grid-column: 1 / -1; }
.rep-title { font-size: 14px; font-weight: 700; }
.rep-sub { font-size: 11.5px; color: var(--muted-foreground); margin-bottom: 12px; }
.rep-empty { font-size: 12.5px; color: var(--muted-foreground); padding: 10px 0; }

.rep-bars { display: flex; flex-direction: column; gap: 9px; }
.rep-bar-row { display: grid; grid-template-columns: 120px 1fr 38px; align-items: center; gap: 10px; }
.rep-bar-lbl { font-size: 12px; color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-bar-track { height: 16px; background: var(--muted); border-radius: 6px; overflow: hidden; }
.rep-bar { height: 100%; border-radius: 6px; min-width: 2px; background: var(--primary); transition: width .3s; }
.rep-bar.k-won { background: #3fae6b; }
.rep-bar.k-lost { background: #d0455f; }
.rep-bar.k-open { background: var(--primary); }
.rep-bar.k-loss { background: #d89a36; }
.rep-bar.k-dest { background: #4e80b5; }
.rep-bar-val { font-size: 12.5px; font-weight: 700; text-align: right; }

.rep-cols { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 10px; }
.rep-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.rep-col-val { font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.rep-col-bar-track { flex: 1; width: 60%; display: flex; align-items: flex-end; }
.rep-col-bar { width: 100%; min-height: 3px; background: var(--gradient-violet, linear-gradient(180deg,#7c4dff,#a78bfa)); border-radius: 6px 6px 0 0; transition: height .3s; }
.rep-col-lbl { font-size: 11px; font-weight: 600; margin-top: 6px; text-transform: capitalize; }
.rep-col-sub { font-size: 10px; color: var(--muted-foreground); }

.rep-mini-kpis { display: flex; gap: 10px; }
.rep-mini-kpis > div { flex: 1; background: var(--muted); border-radius: 10px; padding: 10px; text-align: center; }
.rep-mini-kpis .n { display: block; font-size: 20px; font-weight: 800; }
.rep-mini-kpis .l { display: block; font-size: 10.5px; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }

/* ===== Servidores de IA ===== */
.ai-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; max-width: 1100px; }
.ai-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.ai-card-head { display: flex; align-items: center; gap: 11px; }
.ai-logo { width: 40px; height: 40px; flex: none; border-radius: 11px; display: grid; place-items: center; font-size: 14px; font-weight: 800; color: #fff; background: var(--primary); }
.ai-logo.p-claude { background: #d97757; }
.ai-logo.p-gemini { background: #4e80b5; }
.ai-logo.p-gpt { background: #10a37f; }
.ai-logo.p-deepseek { background: #4d6bfe; }
.ai-name { font-size: 14.5px; font-weight: 700; }
.ai-prov { font-size: 11px; color: var(--muted-foreground); }
.ai-rows { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.ai-rows > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.ai-rows span { color: var(--muted-foreground); }
.ai-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin: 6px 0 2px; cursor: pointer; }

/* Barra de cupo mensual de tokens */
.ag-quota-bar { height: 6px; border-radius: 999px; background: var(--muted); overflow: hidden; margin: 6px 0 4px; }
.ag-quota-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }
.ag-quota-fill.over { background: var(--destructive); }

/* Editor de agente en dos columnas */
.ag-editor-cols { display: flex; gap: 18px; align-items: flex-start; }
.ag-editor-left { flex: 1; min-width: 0; }
.ag-editor-right { width: 380px; flex: none; border-left: 1px solid var(--border); padding-left: 18px; align-self: stretch; }
@media (max-width: 980px) { .ag-editor-cols { flex-direction: column; } .ag-editor-right { width: 100%; border-left: none; border-top: 1px solid var(--border); padding-left: 0; padding-top: 14px; } }

/* Toolbar de editor de texto (prompts) */
.rt-toolbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 5px; border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0; background: var(--muted); position: relative; }
.rt-btn { min-width: 28px; height: 26px; padding: 0 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); cursor: pointer; font-size: 12px; line-height: 1; display: inline-grid; place-items: center; }
.rt-btn:hover { border-color: var(--primary); }
.rt-btn.on { background: var(--primary); color: #fff; }
.rt-toolbar + textarea { border-top-left-radius: 0; border-top-right-radius: 0; }
.rt-emojis { position: absolute; top: 34px; left: 5px; z-index: 5; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 6px; box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.rt-emoji { width: 28px; height: 28px; border: none; background: none; cursor: pointer; font-size: 16px; border-radius: 6px; }
.rt-emoji:hover { background: var(--muted); }

/* Listas de prompts y recursos del agente */
.ag-list { display: flex; flex-direction: column; gap: 8px; }
.ag-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--card); }
.ag-item-main { flex: 1; min-width: 0; }
.ag-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-item-sub { font-size: 11.5px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-rtype { flex: none; width: 38px; height: 26px; border-radius: 6px; background: var(--accent); color: var(--primary); font-size: 9.5px; font-weight: 800; display: grid; place-items: center; letter-spacing: 0.04em; }

/* Chat de prueba del agente */
.ag-test { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ag-test-body { max-height: 380px; min-height: 160px; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--muted); }
.ag-test-empty { color: var(--muted-foreground); font-size: 12.5px; text-align: center; margin: auto; font-style: italic; }
.ag-bubble { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.ag-bubble.me { align-self: flex-end; background: var(--gradient-violet, #7c4dff); color: #fff; border-bottom-right-radius: 4px; }
.ag-bubble.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ag-bubble.ag-typing { color: var(--muted-foreground); font-style: italic; }
.ag-attach { margin-top: 6px; }
.ag-attach img, .ag-attach video { max-width: 200px; max-height: 200px; border-radius: 8px; display: block; }
.ag-attach audio { max-width: 220px; }
.ag-attach a { font-size: 12px; font-weight: 600; color: var(--primary); text-decoration: none; }
.ag-bubble.bot .ag-attach a { color: var(--primary); }
.ag-attach-text { background: rgba(0,0,0,0.04); border-left: 3px solid var(--primary); border-radius: 4px; padding: 6px 8px; font-size: 12.5px; white-space: pre-wrap; }
.ag-attach-cap { font-size: 12px; margin-top: 3px; }

/* Enviar prueba a telefono */
.ag-phone { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; background: var(--card); }
.ag-phone-toggle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ag-phone-row { display: flex; gap: 6px; margin-top: 8px; }
.ag-phone-row .form-control { font-size: 12px; }
.ag-test-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--card); }
.ag-test-input input { flex: 1; }

.pl-chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 9px; }
/* Contenedor fijo (no hace scroll) para el chat: ancla el overlay de drag&drop a la vista visible */
.pl-chat-bodywrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* Overlay para arrastrar y soltar documentos sobre la conversacion (visible aunque el chat este lleno) */
.pl-chat-dropmask { display: none; position: absolute; inset: 8px; z-index: 5; border: 2px dashed var(--primary); border-radius: 12px; background: color-mix(in srgb, var(--primary) 12%, #fff); color: var(--primary); font-weight: 700; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.pl-chat-bodywrap.pl-chat-dragover .pl-chat-dropmask { display: flex; }
.pl-date-divider { text-align: center; font-size: 10px; color: var(--muted-foreground); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; margin: 4px 0 2px; display: flex; align-items: center; gap: 10px; }
.pl-date-divider::before, .pl-date-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.pl-bubble { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; word-wrap: break-word; }
.pl-bubble .t { font-size: 9.5px; opacity: 0.7; margin-top: 3px; }
.pl-bubble.out { align-self: flex-end; background: var(--gradient-violet); color: #fff; border-bottom-right-radius: 4px; }
.pl-bubble.in { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.pl-chat-empty { color: var(--muted-foreground); font-size: 12px; text-align: center; margin: auto; font-style: italic; padding: 20px; }

/* Mensajes pregrabados con categorias */
.pl-chat-quick { padding: 10px 14px 6px; border-top: 1px solid var(--border); background: var(--card); }
.pl-qr-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.pl-qr-head > span { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: var(--muted-foreground); }
.pl-qr-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.pl-qr-tab { font-size: 10.5px; padding: 3px 9px; border-radius: 999px; color: var(--muted-foreground); font-weight: 700; border: none; background: none; cursor: pointer; letter-spacing: 0.02em; }
.pl-qr-tab:hover { color: var(--foreground); }
.pl-qr-tab.active { background: var(--primary); color: #fff; }
.pl-qr-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 116px; overflow-y: auto; }
.pl-quick-chip { font-size: 11.5px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--muted); color: var(--foreground); cursor: pointer; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-quick-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--accent); }
.pl-chat-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--card); align-items: center; }
.pl-chat-input input { flex: 1; border: 1px solid var(--border); border-radius: 999px; padding: 9px 14px; font-size: 13px; min-width: 0; }
.pl-quote-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--card); }
.pl-quote-actions .btn { font-size: 12.5px; padding: 7px 12px; }
.pl-quote-confirm { font-size: 12.5px; font-weight: 600; color: var(--foreground); }
.pl-quote-msg { font-size: 12px; color: var(--muted-foreground); }
.pl-chat-send { width: 38px; height: 38px; border-radius: 50%; background: var(--gradient-violet); color: #fff; border: none; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.pl-chat-send:disabled { opacity: 0.5; cursor: default; }
.pl-chat-send svg { width: 16px; height: 16px; }

/* Adjuntos */
.pl-attach { position: relative; flex-shrink: 0; }
.pl-attach-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--muted); color: var(--muted-foreground); display: grid; place-items: center; cursor: pointer; }
.pl-attach-btn:hover { color: var(--primary); border-color: var(--primary); }
.pl-attach-btn svg { width: 16px; height: 16px; }
.pl-attach-menu { position: absolute; bottom: 44px; left: 0; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding: 6px; display: flex; flex-direction: column; gap: 2px; z-index: 20; min-width: 150px; }
.pl-attach-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; font-size: 12.5px; color: var(--foreground); background: none; border: none; cursor: pointer; text-align: left; }
.pl-attach-item:hover { background: var(--muted); }
.pl-attach-item svg { width: 15px; height: 15px; color: var(--muted-foreground); }
.pl-media-img { max-width: 220px; max-height: 220px; border-radius: 8px; display: block; margin-bottom: 4px; }
.pl-media-doc { display: inline-block; font-size: 12.5px; text-decoration: underline; margin-bottom: 4px; }
.pl-bubble.out .pl-media-doc { color: #fff; }

/* Toggle Datos/Chat: solo visible en movil. */
.pl-lead-mobtabs { display: none; }
@media (max-width: 880px) {
    .pl-lead-dialog { flex-direction: column; max-height: 94vh; }
    .pl-lead-mobtabs { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--border); background: var(--card); flex: 0 0 auto; }
    .pl-lead-mobtabs button { flex: 1; padding: 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--muted); font-weight: 700; font-size: 13px; color: var(--muted-foreground); cursor: pointer; }
    .pl-lead-mobtabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
    /* Mostrar solo el panel seleccionado y dejar que ocupe el alto disponible. */
    .pl-lead-dialog .pl-lead-left, .pl-lead-dialog .pl-chat { flex: 1 1 auto; max-height: none; min-height: 0; }
    .pl-lead-dialog.mob-datos .pl-chat { display: none; }
    .pl-lead-dialog.mob-chat .pl-lead-left { display: none; }
    .pl-chat { border-left: none; border-top: 1px solid var(--border); }
}

/* ===== Pipeline modal: campos por etapa ===== */
.pl-stagegroup { margin-bottom: 18px; }
.pl-stagegroup-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800; color: var(--primary); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.pl-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pl-field.col2 { grid-column: 1 / -1; }
.pl-field-help { font-size: 11px; color: var(--muted-foreground); margin: 2px 0 6px; font-style: italic; }
.pl-multi-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.pl-multi-idx { flex: none; min-width: 22px; height: 22px; border-radius: 6px; background: var(--muted); color: var(--muted-foreground); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.pl-multi-del { flex: none; width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 7px; background: var(--card); color: var(--destructive); cursor: pointer; line-height: 1; font-size: 16px; }
.pl-multi-add { border: 1px dashed var(--border); border-radius: 7px; background: none; color: var(--primary); font-size: 12px; font-weight: 600; padding: 4px 10px; cursor: pointer; }
.cfg-tag { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 1px 6px; border-radius: 5px; background: var(--primary-soft); color: var(--primary); margin-left: 6px; }
/* Boton Guardar con cambios pendientes en el modal del lead: color ambar para llamar la atencion. */
.pl-save-dirty { background: #f59e0b; border: 1px solid #f59e0b; color: #1f2937; font-weight: 700; box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); }
.pl-save-dirty:hover { background: #d97706; border-color: #d97706; color: #fff; }
.pl-saved-flag { font-size: 12px; font-weight: 600; color: #16a34a; display: inline-flex; align-items: center; gap: 4px; }
.pl-saved-flag::before { content: "✓"; font-weight: 700; }
/* Campo Total (solo lectura, calculado). */
.pl-total-field { background: var(--muted); font-weight: 700; color: var(--primary); }

/* Modulo Plantillas de cotizacion */
.pl-tpl-layout { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.pl-tpl-list { padding: 14px; }
.pl-tpl-list-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); margin-bottom: 8px; }
.pl-tpl-item { display: block; width: 100%; text-align: left; border: 1px solid var(--border); border-radius: 10px; background: var(--card); padding: 10px 12px; margin-bottom: 0; cursor: pointer; flex: 1; }
.pl-tpl-item.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.pl-tpl-item-row { display: flex; align-items: stretch; gap: 6px; margin-bottom: 8px; }
.pl-tpl-item-row.active .pl-tpl-item { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.pl-tpl-del { width: 32px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: #b91c1c; font-size: 18px; line-height: 1; cursor: pointer; transition: all .15s; flex-shrink: 0; }
.pl-tpl-del:hover { background: #fee2e2; border-color: #fca5a5; }
.pl-tpl-item .nm { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.pl-tpl-item .mt { font-size: 11px; color: var(--muted-foreground); margin-top: 2px; }
.pl-tpl-default { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 1px 6px; border-radius: 5px; background: var(--primary-soft); color: var(--primary); }
.pl-tpl-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.pl-tpl-html { font-family: var(--bs-font-monospace, monospace); font-size: 12.5px; line-height: 1.5; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.pl-tpl-vars { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.pl-tpl-vars-title { font-size: 11.5px; font-weight: 700; color: var(--muted-foreground); margin-bottom: 8px; }
.pl-tpl-vars-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.pl-tpl-stage-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); margin: 8px 0 5px; opacity: .85; }
.pl-tpl-var { font-size: 11.5px; background: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; color: var(--primary); cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
.pl-tpl-var:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pl-tpl-preview-head { padding: 10px 14px; font-size: 12px; font-weight: 700; color: var(--muted-foreground); background: var(--card); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .04em; }
.pl-tpl-preview { width: 100%; height: 540px; border: 0; background: #fff; display: block; }
@media (max-width: 1100px) {
    .pl-tpl-layout { grid-template-columns: 1fr; }
    .pl-tpl-editor { grid-template-columns: 1fr; }
}
.pl-tpl-gallery { margin-top: 18px; padding: 18px; }
.pl-tpl-gallery-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pl-tpl-assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.pl-tpl-asset { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--card); }
.pl-tpl-asset-thumb { height: 110px; background: #f3f4f6 center/cover no-repeat; display: flex; align-items: center; justify-content: center; }
.pl-tpl-asset-thumb img { max-width: 100%; max-height: 110px; object-fit: contain; }
.pl-tpl-asset-name { font-size: 11.5px; padding: 6px 8px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-tpl-asset-actions { display: flex; gap: 6px; padding: 6px 8px 8px; }
.pl-tpl-asset-actions .btn-sm { font-size: 11px; padding: 3px 7px; flex: 1; }
.cfg-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 0.6rem; background: var(--card); margin-bottom: 6px; }
.cfg-row .grow { flex: 1; min-width: 0; }

/* ===== Nav: insignia "en construccion" ===== */
.doktrino-nav-soon { margin-left: auto; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 6px; background: var(--muted); color: var(--muted-foreground); }

/* Acordeon de la API de integracion en Mi cuenta (colapsado por defecto). */
.acct-api > summary { list-style: none; cursor: pointer; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.acct-api > summary::-webkit-details-marker { display: none; }
.acct-api > summary::before { content: "\25B8"; color: var(--muted-foreground); margin-right: 8px; transition: transform .15s ease; }
.acct-api[open] > summary::before { transform: rotate(90deg); }
.acct-api > summary:hover { background: var(--muted); border-radius: 1.25rem; }

/* =====================================================================
   RESPONSIVE - moviles y tabletas (<= 991px): menu off-canvas + ajustes
   ===================================================================== */
@media (max-width: 991.98px) {
  /* El menu se vuelve un panel deslizable; oculto por defecto (se oculta solo). */
  .doktrino-sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh; height: 100dvh;
    width: 280px;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.18);
  }
  /* Abierto cuando el checkbox esta marcado (el aside vive dentro del panel). */
  .doktrino-nav-toggle:checked ~ .doktrino-panel .doktrino-sidebar { transform: translateX(0); }

  /* Capa oscura detras del menu abierto. */
  .doktrino-nav-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1040; border: 0; }
  .doktrino-nav-toggle:checked ~ .doktrino-nav-overlay { display: block; }

  /* Riel y buscador se ocultan; la hamburguesa abre el menu. */
  .doktrino-rail { display: none; }
  .doktrino-search { display: none; }
  .doktrino-topbar { gap: 10px; padding: 12px 14px; }
  .doktrino-hamburger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; margin-left: -6px;
    border-radius: 10px; cursor: pointer; color: var(--foreground);
  }
  .doktrino-hamburger:hover { background: var(--chrome-surface); }
  .doktrino-hamburger svg { width: 22px; height: 22px; }
  .doktrino-page-title { display: none; }
  .doktrino-topbar-user .nm, .doktrino-topbar-user .em { display: none; }

  /* Mas aire util en pantallas chicas. */
  .doktrino-content { padding: 16px 14px; }
  .page-title { font-size: 1.5rem; }
  .module-head { flex-direction: column; align-items: flex-start; gap: 12px; }

  /* Rejillas comunes a una sola columna. */
  .ai-grid, .rep-grid, .brand-cols { grid-template-columns: 1fr !important; }

  /* Tablas anchas: que hagan scroll horizontal en vez de romper el layout. */
  .table-responsive { -webkit-overflow-scrolling: touch; }
  .doktrino-content .table { display: block; width: 100%; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  /* Modales/cuadros anchos: que quepan en la pantalla. */
  .modal-dialog { margin: 10px; }
}

/* Telefonos pequenos. */
@media (max-width: 560px) {
  .doktrino-topbar-name { font-size: 15px; }
  .doktrino-topbar-logo { height: 20px; }
  .doktrino-help span { display: none; }
  .doktrino-content { padding: 14px 11px; }
  .page-title { font-size: 1.32rem; }
  .page-sub { font-size: .86rem; }
  /* Formularios de 2 columnas (lead, etc.) a una sola columna. */
  .pl-fields { grid-template-columns: 1fr; }
}

/* ====== Sub-controles de Historias (ordenes medicas, servicios, etc.) ====== */
.od-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.od-bar-left { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: #0f172a; }
.od-bar-right { display: flex; gap: 6px; }
.od-w-220 { max-width: 220px; }
.od-card { border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; background: #fff; }
.od-row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; margin-bottom: 12px; align-items: end; }
.od-f label { font-size: 11px; font-weight: 700; color: #334155; text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px; display: block; }
.od-c-1  { grid-column: span 1; }
.od-c-2  { grid-column: span 2; }
.od-c-3  { grid-column: span 3; }
.od-c-4  { grid-column: span 4; }
.od-c-6  { grid-column: span 6; }
.od-c-10 { grid-column: span 10; }
.od-c-11 { grid-column: span 11; }
.od-c-12 { grid-column: span 12; }
.od-posol { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px; }
.od-posol-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.od-mini { font-size: 10px !important; text-align: center; }
.od-posol-preview { font-size: 11px; color: #64748b; font-style: italic; text-align: center; margin-top: 6px; }
.od-input-group { display: flex; gap: 4px; }
.od-input-group > input { flex: 1; }
.od-grid-wrap { margin-top: 14px; border: 1px solid #e2e8f0; border-radius: 6px; overflow: auto; }
.od-tbl { margin: 0; font-size: 12px; }
.od-tbl thead th { background: #0288d1; color: #fff; padding: 8px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.od-tbl td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; }
.od-empty-row { padding: 30px !important; font-style: italic; }
.od-action-col { display: flex; align-items: stretch; }
.od-action-add { width: 100%; align-self: stretch; height: 100%; }

/* ================= Dashboard documental (Fase 2B, prototipo v3.0) ================= */
.dkd { max-width: 1200px; display: flex; flex-direction: column; gap: 18px; }

/* Tarjeta base del dashboard */
.dkd-card {
  background: #fff; border: 1px solid var(--chrome-border);
  border-radius: 18px; padding: 18px 20px;
  box-shadow: 0 2px 10px rgba(70, 62, 38, .05);
}
.dkd-card-h { display: flex; align-items: center; }
.dkd-card-t { font-size: 13px; font-weight: 700; color: #1f2433; }
.dkd-card-chip {
  margin-left: auto; font-size: 11px; font-weight: 500;
  color: var(--chrome-muted); background: var(--chrome-surface);
  padding: 4px 10px; border-radius: 9px;
}
.dkd-link { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--primary); text-decoration: none; }

/* Fila de KPIs */
.dkd-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.dkd-kpi-top { display: flex; align-items: center; gap: 10px; }
.dkd-kpi-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.dkd-kpi-delta {
  margin-left: auto; font-size: 11px; font-weight: 700;
  color: #16a34a; background: #e8f7ee; padding: 3px 8px; border-radius: 8px;
}
.dkd-kpi-val { font-size: 26px; font-weight: 800; color: #1f2433; margin-top: 12px; letter-spacing: -.5px; }
.dkd-kpi-lbl { font-size: 12px; font-weight: 500; color: #9a927c; margin-top: 2px; }
/* Variante de accion requerida (ambar) */
.dkd-card.warn { border-color: #f3d98a; }
.dkd-card.warn .dkd-kpi-val { color: #b8770b; }
.dkd-card.warn .dkd-kpi-delta { color: #b8770b; background: #fff3d6; }

/* Rejilla principal */
.dkd-main { display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; align-items: start; }
.dkd-col { display: flex; flex-direction: column; gap: 18px; }

/* Hero azul */
.dkd-hero {
  background: linear-gradient(125deg, var(--primary-deep), var(--primary));
  border-radius: 20px; padding: 24px 26px; color: #fff;
  box-shadow: 0 16px 40px oklch(0.45 0.24 241 / .28);
}
.dkd-hero-top { display: flex; align-items: flex-start; }
.dkd-hero-lbl { font-size: 12.5px; font-weight: 500; color: oklch(0.85 0.06 237); }
.dkd-hero-val { font-size: 34px; font-weight: 800; margin-top: 4px; letter-spacing: -1px; }
.dkd-hero-sub { font-size: 12px; font-weight: 500; color: oklch(0.84 0.06 237); margin-top: 2px; }
.dkd-hero-pill { margin-left: auto; background: rgba(255,255,255,.16); border-radius: 11px; padding: 8px 14px; font-size: 12px; font-weight: 600; }
.dkd-hero-panel { background: rgba(255,255,255,.12); border-radius: 14px; padding: 15px 17px; margin-top: 18px; }
.dkd-hero-panel-h { display: flex; align-items: center; font-size: 12.5px; font-weight: 600; }
.dkd-hero-panel-h a { margin-left: auto; font-size: 11.5px; font-weight: 500; color: oklch(0.88 0.05 237); text-decoration: none; }
.dkd-bar { display: flex; height: 11px; border-radius: 7px; overflow: hidden; margin-top: 12px; }
.dkd-legend { display: flex; gap: 20px; margin-top: 12px; }
.dkd-legend .k { font-size: 10.5px; font-weight: 500; color: oklch(0.84 0.06 237); }
.dkd-legend .v { font-size: 14px; font-weight: 700; }

/* Ciclo documental */
.dkd-ciclo { display: flex; align-items: flex-end; gap: 16px; height: 130px; margin-top: 18px; padding: 0 6px; }
.dkd-ciclo-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dkd-ciclo-bar { width: 100%; border-radius: 9px 9px 4px 4px; }
.dkd-ciclo-lbl { font-size: 10.5px; font-weight: 600; color: #9a927c; }

/* Soporte documental */
.dkd-soporte { display: flex; gap: 14px; margin-top: 18px; }
.dkd-soporte > div { flex: 1; }
.dkd-soporte .k { font-size: 11px; font-weight: 500; color: #9a927c; }
.dkd-soporte .v { font-size: 22px; font-weight: 800; }
.dkd-soporte-note { font-size: 11px; font-weight: 500; color: var(--chrome-muted); margin-top: 10px; }

/* Actividad reciente */
.dkd-act-head, .dkd-act-row {
  display: grid; grid-template-columns: 110px 1fr 100px 110px 110px; gap: 10px; align-items: center;
}
.dkd-act-head {
  padding: 9px 6px; font-size: 10px; font-weight: 600; color: var(--chrome-label);
  text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--chrome-border);
}
.dkd-act-row { padding: 11px 6px; border-bottom: 1px solid #f6f4ee; }
.dkd-act-code { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--primary); font-weight: 600; }
.dkd-act-doc { font-size: 12.5px; font-weight: 500; color: #37415c; }
.dkd-act-date { font-size: 12px; font-weight: 500; color: #9a927c; }
.dkd-act-dep { font-size: 12px; font-weight: 500; color: #6f6754; }
.dkd-badge { font-size: 11px; font-weight: 700; padding: 4px 11px; border-radius: 9px; }
.dkd-badge.ok { background: #e8f7ee; color: #16a34a; }
.dkd-badge.pend { background: #fff3d6; color: #b8770b; }
.dkd-badge.rev { background: var(--primary-soft); color: var(--primary); }

/* TRD activas (sparkline) */
.dkd-spark { display: flex; align-items: flex-end; gap: 6px; height: 54px; margin-top: 10px; }
.dkd-spark div { flex: 1; border-radius: 5px; }
.dkd-big { font-size: 30px; font-weight: 800; color: #1f2433; margin-top: 8px; letter-spacing: -.7px; }

/* Top series */
.dkd-ts { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 13px; margin-bottom: 6px; text-decoration: none; }
.dkd-ts.hot { background: var(--primary); }
.dkd-ts-rank {
  width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; background: var(--chrome-surface); color: #9a927c;
}
.dkd-ts.hot .dkd-ts-rank { background: rgba(255,255,255,.22); color: #fff; }
.dkd-ts-name { font-size: 12.5px; font-weight: 700; color: #1f2433; }
.dkd-ts.hot .dkd-ts-name { color: #fff; }
.dkd-ts-count { font-size: 11px; font-weight: 500; color: #9a927c; margin-top: 1px; }
.dkd-ts.hot .dkd-ts-count { color: oklch(0.88 0.05 237); }
.dkd-ts-arrow { font-size: 18px; color: #c2bca8; }
.dkd-ts.hot .dkd-ts-arrow { color: oklch(0.88 0.05 237); }

/* Documentos por dependencia */
.dkd-dep { margin-bottom: 13px; }
.dkd-dep-h { display: flex; font-size: 12px; font-weight: 500; color: #37415c; margin-bottom: 6px; }
.dkd-dep-h .pct { margin-left: auto; font-weight: 700; color: #6f6754; }
.dkd-dep-track { height: 7px; border-radius: 5px; background: #f1efe7; overflow: hidden; }
.dkd-dep-fill { height: 100%; border-radius: 5px; }

.dkd-empty { font-size: 12.5px; color: #9a927c; padding: 10px 2px; }

@media (max-width: 1100px) {
  .dkd-kpis { grid-template-columns: repeat(2, 1fr); }
  .dkd-main { grid-template-columns: 1fr; }
}

/* ============ Transacciones documentales (Fase 2C, prototipo v3.0) ============ */
.trx { max-width: 1180px; }
.trx-breadcrumb { font-size: 12.5px; font-weight: 500; color: #9aa3bd; margin-bottom: 14px; }
.trx-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.trx-title { font-size: 20px; font-weight: 800; color: #1f2433; letter-spacing: -.4px; }
.trx-sub { font-size: 12.5px; font-weight: 500; color: #9aa3bd; margin-top: 2px; }
.trx-head-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Toggle tarjetas / lista */
.trx-toggle { display: flex; }
.trx-toggle a {
  cursor: pointer; text-decoration: none;
  border: 1px solid #e6e2d6; background: #fff; color: #8a7f66;
  padding: 9px 14px; font-size: 12px; font-weight: 600;
}
.trx-toggle a:first-child { border-radius: 10px 0 0 10px; }
.trx-toggle a:last-child { border-radius: 0 10px 10px 0; border-left: 0; }
.trx-toggle a.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.trx-btn {
  border: 0; cursor: pointer; background: var(--primary); color: #fff;
  border-radius: 10px; padding: 10px 16px; font-size: 12.5px; font-weight: 700;
  box-shadow: 0 6px 16px var(--primary-shadow); text-decoration: none;
}
.trx-btn.ghost { background: #fff; color: #8a7f66; border: 1px solid #e6e2d6; box-shadow: none; }
.trx-btn.danger { background: #e5484d; box-shadow: 0 6px 16px rgba(229, 72, 77, .25); }

/* Barra de filtros */
.trx-filtros {
  background: #fff; border: 1px solid #efe9dc; border-radius: 14px;
  padding: 14px 16px; margin-bottom: 18px;
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(70, 62, 38, .05);
}
.trx-f { display: flex; flex-direction: column; gap: 6px; }
.trx-f.grow { flex: 1; min-width: 170px; }
.trx-f label {
  font-size: 10px; font-weight: 700; color: #a3abc0;
  text-transform: uppercase; letter-spacing: .5px;
}
.trx-f input, .trx-f select {
  width: 100%; border: 1px solid #e3e7f2; background: #f6f8fc;
  border-radius: 9px; padding: 9px 12px;
  font-size: 12.5px; font-weight: 500; color: #37415c; outline: none;
}

/* Tarjetas */
.trx-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.trx-card {
  background: #fff; border: 1px solid #edeaf1; border-radius: 16px; padding: 18px;
  box-shadow: 0 1px 3px oklch(0.35 0.06 237 / .05);
  transition: transform .12s, box-shadow .12s, border-color .12s;
  text-decoration: none; display: block;
}
.trx-card:hover {
  border-color: oklch(0.86 0.055 237); box-shadow: 0 12px 28px oklch(0.45 0.24 241 / .14);
  transform: translateY(-2px);
}
.trx-card-top { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.trx-num {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600;
  color: var(--primary); background: var(--primary-soft); padding: 3px 10px; border-radius: 8px;
}
.trx-est { font-size: 10.5px; font-weight: 700; padding: 3px 10px; border-radius: 8px; letter-spacing: .3px; }
.trx-est.desarrollo { background: var(--primary-soft); color: var(--primary); }
.trx-est.activo { background: #e8f7ee; color: #15803d; }
.trx-est.cerrado { background: #f1efe7; color: #8a7f66; }
.trx-dep { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: #6b7488; margin-bottom: 4px; }
.trx-obs { font-size: 13px; line-height: 1.4; font-weight: 600; color: #37415c; min-height: 36px; }
.trx-vig { display: flex; gap: 8px; margin: 14px 0 12px; }
.trx-vig > div { flex: 1; background: #faf9f5; border-radius: 10px; padding: 9px 11px; }
.trx-vig .k { font-size: 9.5px; font-weight: 600; color: #a3abc0; text-transform: uppercase; letter-spacing: .4px; }
.trx-vig .v { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; color: #37415c; font-weight: 600; margin-top: 2px; }
.trx-card-foot {
  display: flex; align-items: center; border-top: 1px solid #f2f0f8;
  padding-top: 11px; font-size: 11.5px; font-weight: 500; color: #9aa3bd;
}
.trx-card-foot .go { margin-left: auto; color: var(--primary); font-weight: 700; }

/* Lista */
.trx-list { background: #fff; border: 1px solid #edeaf1; border-radius: 16px; overflow: hidden; box-shadow: 0 1px 3px oklch(0.35 0.06 237 / .05); }
.trx-list-head, .trx-list-row {
  display: grid; grid-template-columns: 130px 120px 1fr 116px 116px 96px 96px 70px;
  gap: 12px; align-items: center;
}
.trx-list-head {
  padding: 12px 18px; background: #161c2e;
  font-size: 10.5px; font-weight: 600; color: #cdd5ea;
  text-transform: uppercase; letter-spacing: .4px;
}
.trx-list-row { padding: 13px 18px; border-bottom: 1px solid #f4f6fb; text-decoration: none; }
.trx-list-row:hover { background: #f8faff; }
.trx-list-row .num { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--primary); font-weight: 600; }
.trx-list-row .txt { font-size: 12.5px; font-weight: 500; color: #37415c; }
.trx-list-row .mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: #6f6754; }

.trx-empty { padding: 40px 18px; text-align: center; color: #9aa3bd; font-size: 13px; }

/* Detalle (acordeones) */
.trx-acc { background: #fff; border: 1px solid #e9ecf5; border-radius: 16px; overflow: hidden; box-shadow: 0 1px 3px oklch(0.35 0.06 237 / .05); margin-bottom: 12px; }
.trx-acc-h { display: flex; align-items: center; gap: 10px; padding: 15px 20px; }
.trx-acc-ico { width: 28px; height: 28px; border-radius: 8px; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.trx-acc-t { font-size: 14px; font-weight: 700; color: #1f2433; flex: 1; }
.trx-acc-meta { font-size: 11px; font-weight: 600; color: #9aa3bd; }
.trx-acc-b { padding: 4px 20px 20px; border-top: 1px solid #f0f2f8; }
.trx-grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 14px; }
.trx-ro {
  border: 1px solid #e3e7f2; background: #f6f8fc; border-radius: 9px;
  padding: 10px 12px; font-size: 12.5px; font-weight: 500; color: #37415c;
}
.trx-detalle-hero {
  background: linear-gradient(135deg, var(--primary-deep), var(--primary));
  color: #fff; padding: 16px 24px; border-radius: 16px; margin-bottom: 16px;
}
.trx-detalle-hero .row1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trx-detalle-hero .chip { font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600; background: rgba(255,255,255,.18); padding: 2px 10px; border-radius: 8px; }
.trx-detalle-hero .est { font-size: 10.5px; font-weight: 700; background: rgba(255,255,255,.16); padding: 2px 10px; border-radius: 8px; letter-spacing: .3px; }
.trx-detalle-hero .ttl { font-size: 15px; font-weight: 800; letter-spacing: -.3px; }
.trx-detalle-hero .sub { font-size: 12px; font-weight: 500; color: oklch(0.85 0.06 237); margin-top: 4px; }

@media (max-width: 1100px) {
  .trx-cards { grid-template-columns: repeat(2, 1fr); }
  .trx-grid5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .trx-cards { grid-template-columns: 1fr; }
}
.trx-lbl {
  font-size: 10px; font-weight: 700; color: #a3abc0;
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px;
}

/* ============ Cliente TRD / encuesta documental (Fase 2D) ============ */
.tcl { max-width: 1120px; margin: 0 auto; }
.tcl-breadcrumb { font-size: 12.5px; font-weight: 500; color: #9aa3bd; margin-bottom: 14px; }

/* Banner de onboarding */
.tcl-coach {
  background: linear-gradient(120deg, var(--primary-soft), #f3f6ff);
  border: 1px solid oklch(0.89 0.06 237); border-radius: 16px;
  padding: 16px 20px; display: flex; align-items: center; gap: 15px; margin-bottom: 16px;
}
.tcl-coach-ico {
  width: 42px; height: 42px; border-radius: 12px; background: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  box-shadow: 0 4px 12px var(--primary-shadow); flex-shrink: 0;
}
.tcl-coach .t { font-size: 13.5px; font-weight: 700; color: #1f2433; }
.tcl-coach .s { font-size: 12px; font-weight: 500; color: #6b7488; margin-top: 2px; }
.tcl-coach .s b { color: var(--primary); }
.tcl-coach-x { cursor: pointer; color: #a3abc0; font-size: 16px; background: none; border: 0; }

/* Asistente de 3 pasos */
.tcl-steps { display: flex; gap: 10px; margin-bottom: 16px; }
.tcl-step {
  display: flex; align-items: center; gap: 9px; flex: 1;
  padding: 11px 14px; border-radius: 13px;
  background: #f7f6f1; border: 1px solid #eee9dc;
}
.tcl-step.done { background: var(--primary-soft); border-color: oklch(0.90 0.05 237); }
.tcl-step .n {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; background: #dcd6c6; color: #8a8268;
}
.tcl-step.done .n { background: var(--primary); color: #fff; }
.tcl-step .t { font-size: 12px; font-weight: 700; color: #2a3346; }
.tcl-step .s { font-size: 10.5px; font-weight: 500; color: #8a93a8; }

/* Tabs */
.tcl-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tcl-tab {
  cursor: pointer; border: 1px solid #e6e2d6; background: #fff; color: #6b7488;
  border-radius: 11px; padding: 9px 16px; font-size: 12.5px; font-weight: 700;
}
.tcl-tab.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tcl-tab .badge2 { background: rgba(255,255,255,.25); padding: 1px 8px; border-radius: 9px; margin-left: 4px; }

/* Dependencia / area productora */
.tcl-dep {
  background: #fff; border: 1px solid #e9ecf5; border-radius: 14px;
  padding: 14px 18px; margin-bottom: 16px; box-shadow: 0 1px 3px oklch(0.35 0.06 237 / .05);
}
.tcl-dep .k { font-size: 10.5px; font-weight: 600; color: #a3abc0; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px; }
.tcl-dep .v { font-size: 15px; font-weight: 700; color: #1f2433; }
.tcl-dep .v .sep { color: #c2cae0; }
.tcl-dep .v .who { font-weight: 500; color: #5a6378; }

/* Dos columnas de la encuesta */
.tcl-cols { display: flex; gap: 16px; align-items: flex-start; }
.tcl-panel.fmt { flex: 0 0 300px; }
/* Columna derecha del picker: formato arriba + propiedades debajo, apilados.
   30% mas ancha que la de formato sola (300 -> 390px). */
.est-right { flex: 0 0 390px; display: flex; flex-direction: column; gap: 14px; align-self: stretch; }
.est-right .tcl-panel.fmt { flex: none; width: 100%; }
.est-right .est-block { width: 100%; }
.tcl-fmt-ayuda { font-size: 11px; color: #9aa3bd; margin-bottom: 10px; }
.tcl-fmt-fila { padding: 9px 0; border-bottom: 1px solid #f4f6fb; }
.tcl-fmt-nom { font-size: 12px; font-weight: 600; color: #37415c; margin-bottom: 6px; }
.tcl-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.tcl-chip { border: 1px solid #e3e7f2; background: #fff; color: #6f6754; border-radius: 20px;
            padding: 4px 10px; font-size: 11px; font-weight: 600; cursor: pointer; }
.tcl-chip:hover { border-color: var(--primary); }
.tcl-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tcl-grp-h { display: flex; align-items: center; gap: 8px; padding: 10px 0 4px;
             font-size: 12.5px; font-weight: 700; color: #37415c; }
.tcl-progreso { font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 20px;
                background: #fdf3e2; color: #a9741f; }
.tcl-progreso.ok { background: #e8f5ee; color: #2f7d54; }
.tcl-panel {
  background: #fff; border: 1px solid #e9ecf5; border-radius: 16px; padding: 16px;
  box-shadow: 0 1px 3px oklch(0.35 0.06 237 / .05);
}
.tcl-panel.izq { flex: 1; }
.tcl-panel.der { flex: 1.2; }
.tcl-panel-t { font-size: 13px; font-weight: 700; color: #1f2433; margin-bottom: 11px; }
.tcl-add {
  width: 100%; cursor: pointer; border: 0; border-radius: 11px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px; font-size: 12.5px; font-weight: 700;
  box-shadow: 0 5px 14px var(--primary-shadow); margin-bottom: 11px;
}
.tcl-input {
  width: 100%; border: 1px solid #e3e7f2; background: #f6f8fc; border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; font-weight: 500; color: #37415c; outline: none;
}
.tcl-input.dashed { border: 1.5px dashed oklch(0.85 0.08 237); background: #f6f9ff; font-weight: 600; }
.tcl-lista { display: flex; flex-direction: column; gap: 2px; max-height: 440px; overflow: auto; margin-top: 11px; }
.tcl-item {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 8px 10px; border-radius: 10px;
  font-size: 12.5px; font-weight: 600; color: #37415c;
}
.tcl-item:hover { background: #f6f8fc; }
.tcl-item.on { background: var(--primary-soft); color: var(--primary); }
.tcl-item .code { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: #aab2c8; margin-left: auto; }
.tcl-propia {
  background: #f0ecfb; color: #7c5cd0; font-size: 8.5px; font-weight: 700;
  padding: 1px 6px; border-radius: 6px; letter-spacing: .3px;
}
.tcl-count { background: var(--chrome-surface); color: #9a927c; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 7px; }

/* Arbol de subseries/tipologias */
.tcl-tree { background: #f7f9fd; border-radius: 12px; padding: 12px; max-height: 430px; overflow: auto; }
.tcl-sub { margin-bottom: 6px; }
.tcl-sub-h { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; font-weight: 700; color: #2a3346; padding: 6px 4px; }
.tcl-sub-h .caret { color: var(--primary); font-size: 11px; width: 12px; }
.tcl-sub-h .code { font-family: 'IBM Plex Mono', monospace; margin-left: auto; font-size: 10px; color: #aab2c8; }
.tcl-tipos { padding-left: 24px; display: flex; flex-direction: column; gap: 7px; padding-bottom: 8px; }
.tcl-tipo { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #37415c; }

/* Tab Estructura */
.tcl-det-t { font-size: 18px; font-weight: 700; color: #1f2433; letter-spacing: -.3px; }
.tcl-det-s { font-size: 13px; font-weight: 400; color: #9aa3bd; margin: 3px 0 16px; }
.tcl-pend {
  background: #fff8e6; border: 1px solid #f3d98a; border-left: 4px solid #e0a82e;
  border-radius: 0 13px 13px 0; padding: 15px 18px; margin-bottom: 18px;
}
.tcl-pend-h { font-size: 13.5px; font-weight: 700; color: #9a7414; display: flex; align-items: center; gap: 8px; }
.tcl-pend-n { background: #e0a82e; color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 9px; }
.tcl-pend-s { font-size: 12.5px; line-height: 1.6; color: #8a6d1a; margin-top: 6px; }
.tcl-pend li { font-size: 12px; font-weight: 500; color: #8a6d1a; list-style: none; }
.tcl-ok {
  background: #e8f7ee; border: 1px solid #bce8cd; border-radius: 13px;
  padding: 14px 18px; margin-bottom: 18px;
  font-size: 13px; font-weight: 600; color: #15803d;
  display: flex; align-items: center; gap: 9px;
}
.tcl-serie-card { background: #fff; border: 1px solid #e9ecf5; border-radius: 16px; overflow: hidden; box-shadow: 0 1px 3px oklch(0.35 0.06 237 / .05); margin-bottom: 16px; }
.tcl-serie-h { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: oklch(0.97 0.015 237); border-bottom: 1px solid #e9ecf5; }
.tcl-serie-h .code { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--primary); font-weight: 600; background: var(--primary-soft); padding: 3px 9px; border-radius: 7px; }
.tcl-serie-h .name { font-size: 13.5px; font-weight: 700; color: #1f2433; }

@media (max-width: 900px) {
  .tcl-cols { flex-direction: column; }
  .tcl-panel.izq, .tcl-panel.der { width: 100%; }
  .tcl-steps { flex-direction: column; }
}
/* Paso 3: formato pendiente (boton ambar) vs declarado */
.tcl-fmt-btn {
  border: 1px solid #e0a82e; background: #fff8e6; color: #9a7414;
  border-radius: 9px; padding: 5px 12px; font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.tcl-fmt-ok {
  background: #e8f7ee; color: #15803d; font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 9px;
}
.tcl-fmt-form { display: flex; gap: 8px; align-items: center; padding: 10px 0 4px; flex-wrap: wrap; }
