/* ==========================================================================
   Admin Panel — First Image Style v5 (optimized, same behavior)
   ==========================================================================
   NOTA: Reordenado por secciones y comentado sin añadir reglas nuevas
   ========================================================================== */


/* == 1) Imports de fuentes ================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');


/* == 2) Design tokens / variables globales ================================= */
:root{
  --nav-h: 72px;
  --sidebar-w: 280px;

  /* Brand */
  --brand: #0D6EFD;
  --brand-rgb: 13,110,253;

  /* Surfaces & chroma */
  --surface: #fff;
  --bg-app:  #f4f7fc;

  /* Lines & borders */
  --border: #e7eaf2;
  --line:   #e7eaf2;

  /* Accents */
  --accent-1: #eef2ff;
  --accent-2: #f5f7ff;
  --accent-3: #e6ebff;

  /* Text */
  --title: #0f172a;
  --muted: #64748b;

  /* Shadows */
  --shadow-1: 0 1px 2px rgba(10, 22, 70, .06);
  --shadow-2: 0 8px 24px rgba(10, 22, 70, .08);
  --shadow-navbar: 0 1px 0 rgba(10,22,70,.06);

  /* Radii */
  --r-sm: .5rem;
  --r-md: .75rem;
  --r-lg: 1rem;
  --r-pill: 999px;

  /* Tokens derivados (evitan literales sueltos) */
  --surface-ghost: rgba(var(--brand-rgb), .08);
  --thead:        rgba(var(--brand-rgb), .06);
  --hover:        #f8fbff;
  --overlay:      rgba(15,23,42,.35);
  --backdrop:     rgba(15,23,42,.6);
  --ring:         0 0 0 .2rem rgba(var(--brand-rgb), .16);
  --chip-ink:     #394b7a;
  --icon-chip-bg: #f2f5ff;

  /* Bootstrap bridges */
  --bs-primary: var(--brand);
  --bs-primary-rgb: var(--brand-rgb);
  --bs-body-bg: transparent; /* usamos gradient en body */
  --bs-card-bg: var(--bg-card);
  --bs-border-color: var(--border);
  --bs-link-color: var(--brand);
}

/*-----------------------------------------------
|   Backgrounds
-----------------------------------------------*/
.bg-holder {
  position: absolute;
  width: 100%;
  min-height: 100%;
  top: 0;
  left: 0;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  will-change: transform, opacity, filter;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background-repeat: no-repeat;
  z-index: -5;
}



.bg-light-gradient {
  background: -webkit-gradient(linear, left top, left bottom, from(rgba(236, 240, 253, 0)), color-stop(14.32%, rgba(236, 240, 253, 0.53)), color-stop(45.83%, #ECF0FD), color-stop(84.33%, rgba(236, 240, 253, 0.43)), to(rgba(236, 240, 253, 0)));
  background: -o-linear-gradient(top, rgba(236, 240, 253, 0) 0%, rgba(236, 240, 253, 0.53) 14.32%, #ECF0FD 45.83%, rgba(236, 240, 253, 0.43) 84.33%, rgba(236, 240, 253, 0) 100%);
  background: linear-gradient(180deg, rgba(236, 240, 253, 0) 0%, rgba(236, 240, 253, 0.53) 14.32%, #ECF0FD 45.83%, rgba(236, 240, 253, 0.43) 84.33%, rgba(236, 240, 253, 0) 100%);
}

.bg-primary-gradient {
  background: -o-linear-gradient(241.82deg, #67C3F3 9.05%, #5A98F2 76.74%);
  background: linear-gradient(208.18deg, #67C3F3 9.05%, #5A98F2 76.74%);
}


/* == 3) Comportamientos de sticky y compensaciones de header =============== */
[data-stem-sticky].sticky-top { top: calc(var(--nav-h) + .5rem); } /* pequeño respiro */
body.header-hidden [data-stem-sticky].sticky-top { top: .5rem; }   /* cuando el header se oculta */


/* == 4) Base: html/body, tipografía y suavizado =========================== */
html, body { height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg-app);
  color: var(--title);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* == 5) Utilidades tipográficas rápidas =================================== */
.prepara {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-style: normal;
  color: #3bc452;
}


/* == 6) Utilidades de layout flexibles ==================================== */
.split{
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.split > .pane{
  flex: 1 1 160px;   /* base ~260px, se apila por debajo de ese ancho */
  min-width: 160px;
}


/* == 7) Páginas de autenticación: viewport iOS robusto ==================== */
/* --- Soporte robusto de viewport en iOS (vh → svh → dvh) --- */
.auth-page{
  /* tu fondo y resto se mantienen */
  min-height: 100vh;   /* fallback general */
  min-height: 100svh;  /* iOS 16– */
  min-height: 100dvh;  /* iOS 16.4+ dinámico */
  background: var(--bg-app);
  color: var(--title);
  position: relative;
  overflow-x: hidden;
  z-index: 0;          /* asegura contexto de apilado detrás del contenido */
}

/* Evita height fijo: en iOS produce “saltos” al cambiar la barra */
.auth-shell{
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
}


/* == 8) Adorno: cuarto de círculo fijo (iPhone-safe) ====================== */
/* ---- Adorno: cuarto de círculo abajo-derecha (a prueba de iPhone) ---- */
.auth-page--quarter::after{
  content:"";
  position: fixed;              /* anclado al viewport */
  right: calc(0px + env(safe-area-inset-right, 0));
  bottom: calc(0px + env(safe-area-inset-bottom, 0));

  /* cuadrado ⇒ círculo; algo más flexible en móviles estrechos */
  width:  clamp(18rem, 36vmin, 42rem);
  height: clamp(18rem, 36vmin, 42rem);

  background: var(--blob-fill, rgba(var(--bs-primary-rgb), .74));
  border-top-left-radius: 100% 100%;
  border-top-right-radius: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;

  pointer-events: none;
  z-index: 0;

  /* Evita glitches de repintado de iOS con fixed + sombras */
  box-shadow: -1rem -1rem 3rem rgba(0,0,0,.06);
  transform: translateZ(0);
}


/* == 9) Auth: ajustes responsive de altura ================================ */
@media (max-height: 640px){
  .auth-shell{ padding-top: 1.25rem; }
}

/* Opcional: aún más compacto en landscape muy bajo */
@media (orientation: landscape) and (max-height: 480px){
  .auth-page--quarter::after{
    width:  clamp(14rem, 40vmin, 28rem);
    height: clamp(14rem, 40vmin, 28rem);
  }
}


/* == 10) Navbar sticky ===================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1050;
  height: var(--nav-h);
  background: var(--surface);
  box-shadow: var(--shadow-navbar);
}
.navbar .navbar-brand { font-weight: 800; color: var(--title); letter-spacing: .2px; }
.navbar .btn { border-radius: .6rem; }


/* == 11) Breadcrumbs con gradiente de fondo =============================== */
.breadcrumb-wrap {
  background: linear-gradient(180deg, rgba(255,255,255,.9) 0%, rgba(255,255,255,0) 100%);
  padding: .5rem 2rem 0;
}
.breadcrumb { margin: 0; }
.breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: #c0c7d4; }
.breadcrumb .breadcrumb-item a { color: var(--muted); text-decoration: none; }
.breadcrumb .active { color: var(--title); font-weight: 600; }


/* == 12) Layout general (grid) y área principal =========================== */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--nav-h));
  transition: grid-template-columns .2s ease;
}
.main { padding: 1.25rem 2rem 2rem; }
@media (max-width: 1099.98px){ .main { padding: 1rem; } }


/* == 13) Sidebar (fija en desktop, deslizable en móvil) =================== */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  overflow-y: auto;
  transition: transform .2s ease;
}
.sidebar-header {
  height: var(--nav-h);
  display:flex; align-items:center; padding: 0 1rem;
  font-weight: 800; color: var(--title);
}

/* Menú lateral: ítems, iconos, estados */
.sidebar-menu .list-group-item {
  border:0; border-radius:0;
  padding: .65rem 1rem; display:flex; align-items:center; gap:.75rem; color:var(--title); position:relative;
}
.sidebar-menu .list-group-item .icon {
  width: 36px; height:36px; border-radius:10px; display:grid; place-items:center;
  background: var(--icon-chip-bg); color:var(--brand); font-size:18px;
}
.sidebar-menu .list-group-item:hover { background:#f6f8ff; }
.sidebar-menu .list-group-item.active {
  background: var(--surface-ghost); color: var(--brand);
  font-weight: 800;
}
.sidebar-menu .list-group-item.active::before {
  content:""; position:absolute; left:0; top:0; bottom:0; width:6px; background:var(--brand);
  border-top-right-radius:6px; border-bottom-right-radius:6px;
}
.sidebar-menu .list-group-item .count {
  margin-left:auto; background:var(--accent-1); color:#334155;
  border-radius:var(--r-pill); font-weight:700; padding:.25rem .5rem; font-size:.8rem;
}


/* == 14) Encabezado de página / acciones ================================== */
.page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom: 1rem; }
.overline { font-size:.72rem; text-transform:uppercase; letter-spacing:.12em; color:var(--muted); font-weight:700; }
.page-title { font-size:1.35rem; font-weight:800; color:var(--title); }
.page-actions .btn + .btn { margin-left: .5rem; }


/* == 15) Superficies tipo card / contenedores ============================= */
.card, .kpi, .table-wrap, .selbar {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  background: var(--surface);
}
.card .card-header { background: var(--surface); border-bottom:1px solid var(--border); color:var(--title); }
.card.elevated { border-color: transparent; box-shadow: var(--shadow-2); }


/* == 16) KPIs compactos ==================================================== */
.kpi{ padding:1rem; }
.kpi .label{ color:var(--muted); font-size:.8rem; text-transform:uppercase; letter-spacing:.02em; }
.kpi .value{ font-size:1.65rem; font-weight:800; color:var(--title); }


/* == 17) Filtros (chips) ================================================== */
.filters { display:flex; gap:.5rem; flex-wrap:wrap; }
.chip{
  display:inline-flex; align-items:center; gap:.5rem;
  background:var(--accent-1); border:1px solid var(--accent-3);
  color:var(--chip-ink); padding:.35rem .6rem; border-radius:var(--r-pill); font-weight:600;
}
.chip .x{ cursor:pointer; }


/* == 18) Tablas con thead sticky y hover ================================== */
.table { margin:0; }
.table-wrap { /* overflow visible para sticky thead */ overflow: visible; }
.table thead th{
  background: var(--thead);
  color: var(--title);
  font-weight: 800;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
.table th .sort { opacity:.55; margin-left:.35rem; font-size:.85em; }
.table th .sort.active { opacity:1; color:var(--brand); }
.table-hover tbody tr:hover { background: var(--hover); }
.table :is(td, th) { vertical-align: middle; }
.table .checkbox { width:42px; }
.table .actions { white-space:nowrap; }


/* == 19) Barra de selección contextual ==================================== */
.selbar { display:none; align-items:center; justify-content:space-between; padding:.55rem .8rem; margin: .85rem 0; }
.selbar.show { display:flex; }


/* == 20) Badges de estado ================================================== */
.badge-status{
  text-transform:uppercase; font-weight:800; letter-spacing:.02em;
  border-radius:var(--r-pill); padding:.4rem .7rem;
}
.badge-status[data-state="finished"]   { background:#198754; color:#ffffff; }
.badge-status[data-state="in_progress"]{ background:#fde68a; color:#7a5200; }
.badge-status[data-state="archived"]   { background:#e2e8f0; color:#46566b; }


/* == 21) Botones (incluye estilo ghost) =================================== */
.btn { border-radius:.6rem; font-weight:600; }
.btn-ghost { background: transparent; border: 1px dashed var(--accent-3); color:#334155; }


/* == 22) Formularios: focus ring consistente ============================== */
.form-control, .form-select { border-radius:.6rem; border-color:#d7ddea; }
.form-control:focus, .form-select:focus { border-color:rgba(var(--brand-rgb),.6); box-shadow: var(--ring); }


/* == 23) Paginación ======================================================== */
.pagination .page-link{ border-radius:.5rem; border-color:var(--border); }


/* == 24) Densidad compacta opcional ======================================= */
body.density-compact .main { padding: 1rem; }
body.density-compact .table { font-size:.94rem; }
body.density-compact .table :is(td, th) { padding-top:.45rem; padding-bottom:.45rem; }


/* == 25) Responsive: sidebar y overlay en móviles ========================= */
@media (max-width: 1099.98px){
  .layout{ grid-template-columns: 1fr; }
  .sidebar{
    position: fixed;
    top: var(--nav-h, 56px); left: 0;
    width: var(--sidebar-w);
    /* iOS: vh → svh → dvh con fallback; la última soportada gana */
    height: calc(100vh  - var(--nav-h, 56px));
    height: calc(100svh - var(--nav-h, 56px));
    height: calc(100dvh - var(--nav-h, 56px));
    transform: translateX(-100%);
    will-change: transform; z-index: 1040;
    -webkit-overflow-scrolling: touch;
  }
  body.sidebar-open .sidebar{ transform: none; }
  .overlay{
    display: block;
    position: fixed;
    top: var(--nav-h, 56px); left: 0; right: 0; bottom: 0;
    background: var(--overlay);
    opacity: 0; pointer-events: none; z-index: 1010; /* < navbar */
    transition: opacity .2s ease;
  }
  body.sidebar-open .overlay{ opacity: 1; pointer-events: auto; }
}

/* Desktop: colapsado/expandido con body flags */
@media (min-width: 1100px){
  body.sidebar-collapsed .layout{ grid-template-columns: 72px 1fr; }
  body.sidebar-collapsed .sidebar{ width:72px; }
  body.sidebar-collapsed .sidebar-header{ display:none; }
  body.sidebar-collapsed .sidebar-menu .list-group-item{ justify-content:center; }
  body.sidebar-collapsed .sidebar-menu .list-group-item > span:not(.icon){ display:none; }
}


/* == 26) Z-index layering con modales ===================================== */
body.modal-open .navbar         { z-index: 1030; }
body.modal-open #toasts         { z-index: 1040; }
body.modal-open .floating-timer { z-index: 1030; }

.modal-backdrop{ background-color: var(--backdrop); }
.modal-backdrop.show{ opacity: .45; }
.modal-content{
  background-color: var(--surface); border:0; border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(2,6,23,.18);
}
.modal-header, .modal-footer{
  border-color: var(--line);
  background-color: var(--bs-light) !important;
}


/* == 27) Detalles/Q y preformateado ======================================= */
details.q summary { list-style: none; cursor: pointer; }
details.q summary::-webkit-details-marker { display: none; }
pre { white-space: pre-wrap; }


/* == 28) Utilidades varias ================================================= */
.minw-0{ min-width:0 !important; }
.truncate-1{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.drag-ghost{ opacity:.6; }
.drag-over{ border:1px dashed var(--bs-secondary); }
.order-index{ display:inline-block; width:2.2ch; min-width:2.2ch; }
.content-editor { min-height: 220px; max-height: 60vh; overflow: auto; }


/* == 29) Tarjetas con toggle (radio/checkbox + card) ====================== */
.toggle-card-group{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.75rem; }
.toggle-card{
  border:1px solid var(--bs-border-color); border-radius:1rem; padding:.9rem 1rem;
  background-color:var(--bs-body-bg); cursor:pointer; transition:border-color .15s, box-shadow .15s;
  min-height:84px;
}
.toggle-card:hover{ border-color:var(--bs-primary); }
.btn-check:checked + .toggle-card{ border-color:var(--bs-primary); background-color: #edf4ff; }
.toggle-card .icon{
  width:2.25rem; height:2.25rem; display:inline-flex; align-items:center; justify-content:center;
  border-radius:.75rem; background:var(--bs-light); margin-right:.5rem; font-size:1.1rem;
}
.btn-check:checked + .toggle-card .icon{ background: rgba(var(--bs-primary-rgb,13,110,253), .1); }
.toggle-card .title{ font-weight:600; }
.toggle-card .desc{ font-size:.875rem; color: var(--bs-secondary-color); }
.toggle-card.disabled{ opacity:.6; cursor:not-allowed; }


/* == 30) Toasts (contenedor y estilo simple) ============================== */
#toasts {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.toast--simple .toast-inner{
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  column-gap: 12px;
}
.toast--simple .btn-close{ margin-left: 8px; }
.toast.toast--simple{
  position: relative;
  border: none;
  border-radius: .65rem;
  background: var(--surface);
  box-shadow: 0 15px 30px rgba(0,0,0,.08);
  min-width: 300px;
  padding: .5rem .75rem;
}
.toast.toast--simple::before{
  content:""; position:absolute; inset:0 auto 0 0; width:6px;
  background: var(--toast-accent, var(--bs-info));
  border-top-left-radius:.75rem; border-bottom-left-radius:.75rem;
}
.toast--simple .toast-icon{
  width:25px; height:25px; border-radius:50%;
  display:grid; place-items:center; color:#fff;
  background: var(--toast-accent, var(--bs-info));
}
.toast--simple .toast-title{ font-weight:700; line-height:1.2; }
.toast--simple .toast-msg{ color: var(--bs-secondary-color); }
.toast-container{ z-index:2000 !important; }


/* == 31) Podium Ranking ==================================================== */
.podium-row { margin-bottom: 1rem; }
.podium .winner-card{ transition:transform .2s ease, box-shadow .2s ease; }
.podium .winner-card .avatar-initial{
  width:56px;height:56px;border-radius:50%;background:#eef2f7;display:flex;align-items:center;justify-content:center;font-weight:700
}
.podium .winner-card .name{ font-weight:600 }
.podium .winner-card .sub{ font-size:.85rem;color:#6b7280 }
.podium .winner-card .big{ font-size:1.25rem;font-weight:700;line-height:1 }
@media (min-width: 768px){
  .podium .col-first   { order: 2; }
  .podium .col-second  { order: 1; }
  .podium .col-third   { order: 3; }
  .podium .col-first   .winner-card { transform: translateY(-8px) scale(1.03); }
  .podium .col-second  .winner-card { transform: translateY(8px); }
  .podium .col-third   .winner-card { transform: translateY(16px); }
}
.podium .first  .border-top{ border-top:4px solid #f7c948 !important; }
.podium .second .border-top{ border-top:4px solid #bfc7d5 !important; }
.podium .third  .border-top{ border-top:4px solid #d6a680 !important; }


/* == 32) Course Status (pasos con progreso) =============================== */
.steps {
  --step-size: 40px;
  --track: #d9dde3;
  --muted: #8b97a8;

  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0;
}
.steps::before {
  content: "";
  position: absolute;
  top: calc(var(--step-size) / 2 - 3px);
  left: calc(var(--step-size) / 2);
  right: calc(var(--step-size) / 2);
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--track);
  z-index: 0;
}
.steps::after {
  content: "";
  position: absolute;
  top: calc(var(--step-size) / 2 - 3px);
  left: calc(var(--step-size) / 2);
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--bs-primary);
  width: calc((100% - var(--step-size)) * (var(--done) / var(--segments)));
  z-index: 1;
}
.step { position: relative; flex: 1 1 0; text-align: center; }
.step .icon {
  position: relative; z-index: 2;
  width: var(--step-size); height: var(--step-size); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #e9eef5; color: var(--muted);
  box-shadow: 0 0 0 4px var(--surface);
  margin: 0 auto;
}
.step.completed .icon, .step.current .icon { background: var(--bs-primary); color: #fff; }
.step .label { margin-top: .5rem; font-weight: 500; color: #6c757d; white-space: nowrap; }


/* == 33) Temporizador flotante (FAB) ====================================== */
.floating-timer {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  left: auto; top: auto; z-index: 1060;

  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: var(--r-pill);

  background: rgba(17, 24, 39, 0.92); color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  backdrop-filter: saturate(140%) blur(6px);

  font-weight: 600; font-size: 14px; line-height: 1;
}
.floating-timer[hidden] { display: none !important; }
.floating-timer__icon { opacity: .9; }
@media (min-width: 1024px) {
  .floating-timer {
    padding: 14px 18px; font-size: 18px; box-shadow: 0 10px 28px rgba(0,0,0,0.2);
    bottom: max(80px, env(safe-area-inset-bottom));
  }
  .floating-timer__icon { transform: scale(1.1); }
}


/* == 34) Accesibilidad: reduce motion ===================================== */
@media (prefers-reduced-motion: reduce){
  * { transition: none !important; animation: none !important; }
}


/* == 35) EDGE LATERAL TEST: botón flotante ================================ */
.edge-toggle{
  position: fixed;
  top: 28%;
  right: 0;
  transform: translate(50%, -50%);
  width: 56px; height: 56px;
  border: 0; border-radius: 9999px;
  background: var(--edge-btn); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 8px 20px rgba(0,0,0,.15);
  cursor: pointer; z-index: 1050;
}
.edge-toggle:hover { filter: brightness(1.05); }
.edge-toggle:active { transform: translate(50%, -50%) scale(.98); }
.edge-toggle:focus-visible{
  outline: 3px solid rgba(255,255,255,.9);
  outline-offset: 2px;
}
.edge-toggle svg{
  transition: transform .25s;
  margin-right: 21px;
}
html[data-nav="open"] .edge-toggle svg{ transform: rotate(180deg); }

@media (max-width: 768px){
  .edge-toggle{ top: auto; bottom: 70px; right: 16px; transform: none; }
  .edge-toggle:active { transform: scale(.98); }
  .edge-toggle svg{ margin-right: 0px; }
}


/* == 36) Truncado de lineas (extras) ===================================== */
.hp-title{
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hp-title2{
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-2{
  display: -webkit-box;
  -webkit-line-clamp: 2;   /* nº de líneas */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3{
  display: -webkit-box;
  -webkit-line-clamp: 3;   /* nº de líneas */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* == 37) Timeline de prioridad con carril y máscaras ====================== */
#hp_prioridad{
  position: relative;
  overflow: hidden;                /* la línea nunca se sale del bloque */
  --hp-line-x: 2.25rem;            /* (fallback) posición horizontal del carril */
}

/* Carril vertical continuo detrás de todo */
#hp_prioridad::before{
  content:"";
  position:absolute;
  left: var(--hp-line-x);
  top: 16px;
  bottom: 0;
  width: 3px;
  background: var(--bs-border-color);
  z-index: 0; /* por detrás de anillos y máscaras */
  height: 80%;
}

#hp_prioridad .list-group-item{ position: relative; }
#hp_prioridad .hp-ring{ position: relative; z-index: 2; } /* el anillo siempre por encima */

/* Máscaras del carril (tapan la parte superior e inferior) */
#hp_prioridad .hp-ring::before,
#hp_prioridad .hp-ring::after{
  content:"";
  position:absolute;
  left:50%; transform:translateX(-50%);
  width:2px;
  background: var(--bs-card-bg, var(--bs-body-bg, #fff));
  display:none;
  z-index: 1;                      /* por encima del carril, por debajo del anillo */
}

/* En el PRIMER ítem: tapa desde arriba hasta el centro del anillo */
#hp_prioridad .list-group-item:first-child .hp-ring::before{
  display:block;
  top:-100vh;                      /* llega sobrado hasta el borde superior del bloque */
  bottom:50%;
}

/* En el ÚLTIMO ítem: tapa desde el centro hasta abajo */
#hp_prioridad .list-group-item:last-child .hp-ring::after{
  display:block;
  top:50%;
  bottom:-100vh;                   /* llega sobrado hasta el borde inferior del bloque */
}


/* == 38) Tooltips temáticos y texto justificado =========================== */
.tt-topics {
  --bs-tooltip-bg: rgba(17, 24, 39, 0.96); /* gris-azul oscuro */
  --bs-tooltip-color: #fff;                 /* texto blanco */
  --bs-tooltip-max-width: 420px;            /* opcional, un poco más ancho */
  --bs-tooltip-padding-x: .6rem;
  --bs-tooltip-padding-y: .45rem;
  --bs-tooltip-font-size: .875rem;
}

.text-justify { text-align: justify; hyphens: auto; overflow-wrap: anywhere; }


/* == 39) Card promo con blob radial sutil ================================ */
.promo-card { position: relative; isolation: isolate; }
.promo-card::after {
  content: "";
  position: absolute;
  right: -250px;
  top: 50%;
  transform: translateY(-50%);
  width: 60%;
  aspect-ratio: 1 / 1;
  background: radial-gradient(circle at center, #AFC7FF 0%, #3B82F6 40%, var(--bs-primary, #0d6efd) 80%);
  opacity: .12;
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
}


/* == 40) TEST MODE (desktop ≥1100): colapsado por defecto ================= */
@media (min-width: 1100px){
  /* Solo aplica estilos de collapse si el body tiene .sidebar-collapsed */
  body.test-mode.sidebar-collapsed .layout{ grid-template-columns: 72px 1fr; }
  body.test-mode.sidebar-collapsed .sidebar{ width:72px; }
  body.test-mode.sidebar-collapsed .sidebar-header{ display:none; }
  body.test-mode.sidebar-collapsed .sidebar-menu .list-group-item{ justify-content:center; }
  body.test-mode.sidebar-collapsed .sidebar-menu .list-group-item > span:not(.icon){ display:none; }

  /* Estado expandido durante test (restaura ancho normal) */
  body.test-mode:not(.sidebar-collapsed) .layout{ grid-template-columns: var(--sidebar-w, 280px) 1fr; }
  body.test-mode:not(.sidebar-collapsed) .sidebar{ width: var(--sidebar-w, 280px); }

  /* En desktop no usamos overlay */
  body.test-mode .overlay{ display:none !important; }
}


/* == 41) CUSTOM TEST MODAL (grid de modos) ================================ */
#customTestModal .mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}
#customTestModal .mode-card {
  display: flex; align-items: center; gap: .75rem;
  padding: .9rem; border: 1px solid rgba(0,0,0,.08); border-radius: .75rem;
  background: #fff; transition: box-shadow .2s ease, transform .05s ease, border-color .2s ease;
  cursor: pointer; user-select: none;
}
#customTestModal .mode-card:hover { box-shadow: 0 6px 20px rgba(43,55,86,.08); border-color: rgba(0, 98, 255, .35); }
#customTestModal .mode-card.selected { border-color: rgba(0, 98, 255, .6); box-shadow: 0 6px 20px rgba(43,55,86,.12); }
#customTestModal .mode-icon {
  width: 44px; height: 44px; border-radius: .75rem;
  background: rgba(0, 123, 255, .15);
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
#customTestModal .mode-title { font-weight: 600; line-height: 1.1; }
#customTestModal .mode-desc { font-size: .85rem; color: #6c757d; margin: 0; }
#customTestModal .section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
#customTestModal input.form-range { width: 100% !important; display: block; }


.tt-contrast { --bs-tooltip-color: #fff !important; --bs-tooltip-max-width: 640px; }
.tt-nowrap .tooltip-inner { text-align: left; }
.tt-nowrap .tooltip-inner .tt-row { white-space: nowrap; display: block; }

/* == 42) CARD HEADER  ================================ */
.stat-card-icon {
    position: absolute;
    top: 15px;
    left: -15px;
    height: 40px;
    border-radius: 999px;
    background: var(--bs-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: 0 2.1rem;
    /* box-shadow: 0 12px 28px rgba(37, 99, 235, 0.6); */
    color: #000;
    /* font-size: .8rem; */
    font-weight: 500;
    white-space: nowrap;
}

.card-badge-title {
  display: inline-flex;
  align-items: center;

  background: var(--bs-light);
  font-weight: 500;            /* fw-normal */
  margin-left: -30px;

  padding: 0.55rem 2rem;       /* py-3 px-3 */
  border-radius: 50rem;        /* rounded-pill */

  /* Para simular rounded-start-0 (lado izquierdo recto) */
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
    /* shadow-sm */
  box-shadow: 0 .125rem .25rem rgba(0, 0, 0, 0.075);
}

.pt-6 {
  padding-top: 4rem !important; /* equivalente a 72px si 1rem = 16px */
}
/* Wrapper genérico para los charts de este widget */
.dash-users-devices .chart-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  /* Evita que desborde horizontalmente el card */
  overflow: hidden;
}

/* Altura relativa para la línea (un poco más alta) */
.dash-users-devices .chart-wrapper-tall {
  padding-bottom: 55%; /* ajusta al gusto (40–70) */
}

/* Altura relativa para la de barras (algo más baja si quieres) */
.dash-users-devices .chart-wrapper-short {
  padding-bottom: 45%;
}

/* El canvas rellena el wrapper y se adapta al tamaño */
.dash-users-devices .chart-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Por si acaso en otros sitios */
.dash-users-devices canvas {
  max-width: 100%;
}