/* ═══════════════════════════════════════════════════════
   RADIA — Design System
   ═══════════════════════════════════════════════════════ */

/*  */
:root
{
  /* ── Brand colours ── */
  --nav-dark:              #1a3353;
  --nav-dark-hover:        #142843;
  --nav-mid:               #2471a3;
  --accent-blue:           #3b82f6;
  --accent-teal:           #0891b2;

  /* ── Surface colours ── */
  --bg-page:               #f4f6f9;
  --bg-card:               #ffffff;
  --bg-light:              #f8fafc;
  --bg-input:              #fafbfd;
  --border:                #e3e8ef;
  --border-light:          #eef1f5;

  /* ── Text colours ── */
  --text-dark:             #1e293b;
  --text-mid:              #64748b;
  --text-light:            #94a3b8;
  --text-white:            #ffffff;

  /* ── Scrollbar ── */
  --scrollbar-thumb:       #cbd5e1;
  --scrollbar-thumb-hover: #94a3b8;

  /* ── Shadows ── */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.06);
  --shadow-md:  0 2px 6px rgba(0,0,0,.06), 0 6px 20px rgba(0,0,0,.08);
  --shadow-lg:  0 4px 12px rgba(0,0,0,.08), 0 12px 32px rgba(0,0,0,.10);

  /* ── Typography ── */
  --font-body:  'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --fs-2xs:    .68rem;
  --fs-xs:     .72rem;
  --fs-sm:     .78rem;
  --fs-md:     .82rem;
  --fs-base:   .855rem;
  --fs-lg:     .9rem;
  --fs-xl:     1.05rem;
  --fs-2xl:    1.15rem;
  --fs-3xl:    1.25rem;

  /* ── Border radius ── */
  --radius-xs:   4px;
  --radius-sm:   7px;
  --radius-md:   10px;
  --radius-lg:   13px;
  --radius-pill: 999px;

  /* ── Layout ── */
  --avatar-size:      46px;
  --search-max-width: 290px;
  --navbar-h:         56px;
  --sidebar-w:        210px;
  --sidebar-w-col:    52px;

  /* ── Spacing ── */
  --sp-1:  4px;
  --sp-2:  6px;
  --sp-3:  8px;
  --sp-4:  10px;
  --sp-5:  12px;
  --sp-6:  14px;
  --sp-7:  16px;
  --sp-8:  20px;

  /* ── Letter-spacing ── */
  --ls-tight: -.012em;
  --ls-xs:     .04em;
  --ls-sm:     .05em;
  --ls-md:     .06em;
  --ls-lg:     .08em;
  --ls-xl:     .11em;

  /* ── Motion ── */
  --transition-card: transform .18s ease, box-shadow .18s ease;
  --transition-fast: all .15s ease;
}

/*  */
*
{
  box-sizing: border-box;
}

/*  */
body
{
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--text-dark);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/*  */
body.has-fixed-navbar
{
  padding-top: var(--navbar-h);
}


/* ══════════════════════════════════
   NAVBAR
   ══════════════════════════════════ */

/*  */
.navbar-brand
{
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: var(--ls-tight);
}

/*  */
.navbar-subtitle
{
  font-size: var(--fs-xs);
  font-weight: 400;
  color: rgba(255,255,255,.45);
  padding-left: 12px;
  border-left: 1px solid rgba(255,255,255,.18);
  line-height: 1.3;
  white-space: nowrap;
}

/*  */
.bg-nav
{
  background: var(--nav-dark) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 2px 10px rgba(0,0,0,.2);
  height: var(--navbar-h);
}

/*  */
.nav-logo
{
  height: 26px;
  opacity: .88;
  filter: brightness(1.05);
}

/*  */
.text-nav
{
  color: var(--nav-dark) !important;
}

/*  */
.navbar .btn-outline-light
{
  border-color: rgba(255,255,255,.25);
  font-size: var(--fs-sm);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

/*  */
.navbar .btn-outline-light:hover
{
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.4);
}


/* ══════════════════════════════════
   BREADCRUMB
   ══════════════════════════════════ */

/*  */
nav[aria-label="breadcrumb"]
{
  background: var(--bg-card) !important;
  border-bottom: 1px solid var(--border-light) !important;
}

/*  */
.breadcrumb-item a
{
  color: var(--nav-dark);
  font-weight: 500;
}

/*  */
.breadcrumb-item.active
{
  color: var(--text-mid);
}

/*  */
.breadcrumb
{
  font-size: var(--fs-sm);
}


/* ══════════════════════════════════
   BUTTONS
   ══════════════════════════════════ */

/*  */
.btn
{
  font-weight: 500;
  letter-spacing: .01em;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

/*  */
.btn-primary
{
  background: var(--nav-dark);
  border-color: var(--nav-dark);
}

/*  */
.btn-primary:hover,
.btn-primary:focus
{
  background: var(--nav-dark-hover);
  border-color: var(--nav-dark-hover);
  box-shadow: 0 0 0 3px rgba(26,51,83,.2);
}

/*  */
.btn-outline-primary
{
  color: var(--nav-dark);
  border-color: var(--nav-dark);
}

/*  */
.btn-outline-primary:hover
{
  background: var(--nav-dark);
  border-color: var(--nav-dark);
}


/* ══════════════════════════════════
   SEARCH BOX
   ══════════════════════════════════ */

/*  */
.search-box
{
  max-width: var(--search-max-width);
}

/*  */
.search-box .form-control,
.search-box .input-group-text
{
  border-radius: var(--radius-pill) !important;
  border-color: var(--border);
  font-size: var(--fs-base);
  background: var(--bg-card);
}

/*  */
.search-box .form-control
{
  border-left: none !important;
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0 !important;
}

/*  */
.search-box .input-group-text
{
  border-right: none !important;
  border-radius: var(--radius-pill) 0 0 var(--radius-pill) !important;
  color: var(--text-light);
}

/*  */
.search-box .form-control:focus
{
  box-shadow: none;
  border-color: var(--border);
}


/* ══════════════════════════════════
   CARDS
   ══════════════════════════════════ */

/*  */
.card
{
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm);
  background: var(--bg-card);
}

/*  */
.section-card
{
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-sm) !important;
}


/* ══════════════════════════════════
   SECTION TITLE
   ══════════════════════════════════ */

/*  */
.section-title
{
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--ls-lg);
  text-transform: uppercase;
  color: var(--nav-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border-light);
  position: relative;
}

/*  */
.section-title::after
{
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 36px;
  height: 2px;
  background: var(--nav-mid);
  border-radius: 2px;
}


/* ══════════════════════════════════
   FIELD GROUPS
   ══════════════════════════════════ */

/*  */
.field-group
{
  margin-bottom: var(--sp-6);
}

/*  */
.field-group label
{
  font-size: .69rem;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: var(--ls-sm);
  margin-bottom: 5px;
  display: block;
}

/*  */
.form-control,
.form-select
{
  border-color: var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  font-size: var(--fs-base);
  color: var(--text-dark);
  transition: border-color .15s, box-shadow .15s;
}

/*  */
.form-control:focus,
.form-select:focus
{
  border-color: var(--nav-mid);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(36,113,163,.12);
}

/*  */
.form-label
{
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-dark);
}

/*  */
.readonly-field
{
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 6px var(--sp-4);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text-dark);
  min-height: 36px;
}


/* ══════════════════════════════════
   INFO ROWS
   ══════════════════════════════════ */

/*  */
.info-row
{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: var(--fs-base);
}

/*  */
.info-row:last-child
{
  border-bottom: none;
}

/*  */
.info-label
{
  color: var(--text-mid);
  font-size: var(--fs-sm);
  font-weight: 500;
  flex-shrink: 0;
  margin-right: var(--sp-3);
}

/*  */
.info-val
{
  font-weight: 600;
  color: var(--text-dark);
  text-align: right;
}


/* ══════════════════════════════════
   BADGES & PILLS
   ══════════════════════════════════ */

/*  */
.analysis-id-badge
{
  background: var(--nav-dark);
  color: var(--text-white);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--ls-md);
  padding: 3px var(--sp-3);
  border-radius: var(--radius-sm);
}


/* ══════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════ */

/*  */
::-webkit-scrollbar
{
  width: 6px;
  height: 6px;
}

/*  */
::-webkit-scrollbar-track
{
  background: transparent;
}

/*  */
::-webkit-scrollbar-thumb
{
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-xs);
}

/*  */
::-webkit-scrollbar-thumb:hover
{
  background: var(--scrollbar-thumb-hover);
}


/* ══════════════════════════════════
   SIDEBAR — navegación global
   ══════════════════════════════════ */

/*  */
.sidebar
{
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--nav-dark);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .2s ease;
  border-right: 1px solid rgba(255,255,255,.06);
  box-shadow: 2px 0 14px rgba(0,0,0,.18);
}

/*  */
.sidebar.collapsed
{
  width: var(--sidebar-w-col);
}

/*  */
.sidebar-inner
{
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  scrollbar-width: none;
}

/*  */
.sidebar-inner::-webkit-scrollbar
{
  display: none;
}

/*  */
.sidebar-item
{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: rgba(255,255,255,.62);
  text-decoration: none !important;
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: color .15s, background .15s, border-color .15s;
  white-space: nowrap;
  border-left: 3px solid transparent;
  position: relative;
}

/*  */
.sidebar-item:hover
{
  color: #fff;
  background: rgba(255,255,255,.08);
  border-left-color: rgba(255,255,255,.25);
}

/*  */
.sidebar-item.active
{
  color: #fff;
  background: rgba(255,255,255,.12);
  border-left-color: var(--accent-teal);
}

/*  */
.sidebar-item i
{
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  font-size: .82rem;
}

/*  */
.sidebar-label
{
  transition: opacity .15s;
  flex: 1;
}

/*  */
.sidebar.collapsed .sidebar-label
{
  opacity: 0;
}

/*  */
.sidebar.collapsed .sidebar-item::after
{
  content: attr(data-label);
  position: absolute;
  left: calc(var(--sidebar-w-col) + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: #1e3a5f;
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  box-shadow: var(--shadow-md);
  z-index: 400;
}

/*  */
.sidebar.collapsed .sidebar-item:hover::after
{
  opacity: 1;
}

/*  */
.sidebar-divider
{
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 6px 12px;
  flex-shrink: 0;
}

/*  */
.sidebar-footer
{
  flex-shrink: 0;
  padding-bottom: 6px;
}

/*  */
.sidebar-user-row
{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  color: rgba(255,255,255,.38);
  font-size: var(--fs-xs);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

/*  */
.sidebar-user-row i
{
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  font-size: .82rem;
}

/*  */
.sidebar-user-row .sidebar-label
{
  color: rgba(255,255,255,.38);
  min-width: 0;                 /* permite que el flex item se encoja para truncar */
  overflow: hidden;             /* recorta el texto que no cabe */
  white-space: nowrap;          /* mantiene el nombre en una sola línea */
  text-overflow: ellipsis;      /* muestra "…" cuando el nombre es muy largo */
}

/* Hacemos clickable toda la fila de cada checkbox del consentimiento */
.consent-check-label
{
  cursor: pointer;
}

/* Checkbox del consentimiento: borde marcado (antes se veía muy tenue sobre la
   tarjeta blanca). Refuerza el contorno y usa el azul de marca al marcar. */
.consent-check
{
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid #1E3A5F;
  background-color: #ffffff;
  cursor: pointer;
}
.consent-check:checked
{
  background-color: #0070C0;
  border-color: #0070C0;
}
.consent-check:focus
{
  border-color: #0070C0;
  box-shadow: 0 0 0 .2rem rgba(0, 112, 192, .25);
}

/*  */
.sidebar.collapsed .sidebar-user-row::after
{
  content: attr(data-label);
  position: absolute;
  left: calc(var(--sidebar-w-col) + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: #1e3a5f;
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  box-shadow: var(--shadow-md);
  z-index: 400;
}

/*  */
.sidebar.collapsed .sidebar-user-row:hover::after
{
  opacity: 1;
}

/*  */
.sidebar-item-logout:hover
{
  background: rgba(239,68,68,.14) !important;
  border-left-color: #ef4444 !important;
  color: #fca5a5 !important;
}

/*  */
#page-wrapper.with-sidebar
{
  margin-left: var(--sidebar-w);
  transition: margin-left .2s ease;
}

/*  */
#page-wrapper.with-sidebar.sidebar-collapsed
{
  margin-left: var(--sidebar-w-col);
}

/*  */
.sidebar-toggle-nav
{
  background: none;
  border: none;
  color: rgba(255,255,255,.72);
  padding: 5px 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
  font-size: .95rem;
  line-height: 1;
}

/*  */
.sidebar-toggle-nav:hover
{
  color: #fff;
  background: rgba(255,255,255,.1);
}


/* ══════════════════════════════════
   MODALS
   ══════════════════════════════════ */

/*  */
.modal-content
{
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/*  */
.modal-header-dark
{
  background: linear-gradient(135deg, var(--nav-dark) 0%, #1f4068 100%);
}

/*  */
.modal-header
{
  padding: 14px 20px;
}

/*  */
.modal-footer
{
  padding: 12px 20px;
  background: var(--bg-light);
  border-top: 1px solid var(--border-light);
}

/*  */
.modal-icon-circle
{
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/*  */
.modal-icon-circle-danger
{
  background: #fff0f0;
}

/*  */
.modal-icon-circle-warning
{
  background: #fffbeb;
}

/*  */
.modal-icon-inner
{
  font-size: .9rem;
}


/* ══════════════════════════════════
   MISC
   ══════════════════════════════════ */

/*  */
.modal-dialog-sm
{
  max-width: 420px;
}


/* ══════════════════════════════════
   RESPONSIVE — móvil
   ══════════════════════════════════ */

/*  */
@media (max-width: 767px)
{
  /*  */
  .sidebar
  {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    transition: transform .2s ease;
  }

  /*  */
  .sidebar.mobile-open
  {
    transform: translateX(0);
  }

  /*  */
  #page-wrapper.with-sidebar,
  #page-wrapper.with-sidebar.sidebar-collapsed
  {
    margin-left: 0;
  }

  /*  */
  .sidebar-backdrop
  {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.42);
    z-index: 199;
  }

  /*  */
  .sidebar-backdrop.show
  {
    display: block;
  }

  /*  */
  .search-box
  {
    max-width: 100%;
  }

  /*  */
  .modal-dialog,
  .modal-dialog-sm
  {
    margin: .3rem;
    max-width: calc(100% - .6rem);
  }

  /*  */
  .info-row
  {
    flex-wrap: wrap;
  }

  /*  */
  .info-val
  {
    text-align: left;
  }

  /*  */
  .navbar-brand
  {
    font-size: var(--fs-lg);
  }

  /*  */
  .nav-logo
  {
    height: 22px;
  }
}


/* ══════════════════════════════════
   RESPONSIVE — tablet
   ══════════════════════════════════ */

/*  */
@media (min-width: 768px) and (max-width: 1024px)
{
  /*  */
  .modal-dialog-sm
  {
    max-width: 480px;
  }
}

/*  */
.ts-dropdown .ts-dropdown-content
{
  max-height: 420px;
}

/* ═══════════════════════════════════════════════════════
   Tipografía de vistas alineada al sidebar (--fs-sm)
   Las tablas y los controles compactos de Bootstrap traen
   tamaños propios (.875rem ≈ 14px) mayores que el sidebar
   (.78rem): aquí se unifican a la misma escala.
   ═══════════════════════════════════════════════════════ */

/* Tablas: encabezados y celdas al tamaño del sidebar */
.table
{
  font-size: var(--fs-sm);
}

/* Evitamos la doble reducción en celdas que usan la clase .small */
.table .small,
.table small
{
  font-size: var(--fs-sm);
}

/* Controles compactos (filtros, botones de acción) a la misma escala */
.btn-sm,
.form-control-sm,
.form-select-sm,
.input-group-sm > .form-control,
.input-group-sm > .form-select,
.input-group-sm > .input-group-text
{
  font-size: var(--fs-sm);
}

/* ── Selector de plantilla del modal "Nuevo Análisis" ────────────────────────
   Con plantillas de nombre largo, Tom Select envolvía el valor seleccionado a
   dos líneas dentro del control; eso aumentaba su altura y empujaba hacia abajo
   el botón "Crear análisis" del footer justo al pulsarlo, obligando a un segundo
   clic. Forzamos el valor seleccionado a UNA sola línea con puntos suspensivos
   para que la altura del control no cambie (el desplegable sigue mostrando el
   texto completo al elegir). */
#modalNewAnalysis .ts-wrapper.single .ts-control
{
  flex-wrap: nowrap;
}
#modalNewAnalysis .ts-wrapper.single .ts-control > .item
{
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
