/* Font and base colors */
body {
  background: var(--bs-body-bg, #f7f7f8);
  color: var(--bs-body-color, #232629);
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* Variables de color del tema */
:root {
  /* Color de acento principal */
  --main-accent: #3b82f6;
  /* Acento oscuro para hover y estados activos */
  --main-accent-hover: #2563eb;
  /* Acento muy claro para fondos de focus/hover */
  --main-accent-light: #eff6ff;
  --border-color: #e2e8f0;
  --sidebar-bg: #f5f5f7;
  /* Fondo claro para ítem activo del sidebar */
  --sidebar-active: #e6ecfa;
  --sidebar-text: #232629;
  --sidebar-icon: #8a8f98;
  --sidebar-active-icon: #4e73df;
  --topbar-bg: #f5f5f7;
  --alert-info: #4e73df;
  --alert-warning: #f6c23e;
  --alert-danger: #e74a3b;
  --alert-success: #1cc88a;
  /* Colores de los resultados de vulnerabilidades */
  --vuln-cri: #e15454;
  --vuln-hig: #df9143;
  --vuln-med: #edc815;
  --vuln-low: #81bfd3;
  --vuln-inf: #c3c3c3;
  /* Colores de la timeline */
  --timeline: #5a5c69;

  /* Sidebar: estados hover y activo compacto */
  --sidebar-brand-color: #6e707e;
  --sidebar-hover-bg: #ececec;
  --sidebar-active-bg: #e0e0e2;
  --sidebar-accent-alt: #10a37f;

  /* Fondo secundario de la interfaz (headers, footer, inputs) */
  --body-secondary-bg: #f7f7f8;
  --muted-color: #888888;

  /* Separadores */
  --separator-text-color: #969696;
  --separator-line-color: #dadada;

  /* Componente info-form */
  --info-form-border: #b6b8c7;
  --info-form-text: #9b9daa;

  /* Paginación */
  --pagination-btn-bg: #f0f0f0;
  --pagination-btn-color: #333333;
  --pagination-btn-disabled: #999999;

  /* Tabs */
  --tab-inactive-color: #858796;
  --tab-active-color: #4e73df;
  --tab-border-color: #e3e6f0;
}

[data-bs-theme='dark'] {
  --main-accent-light: rgba(59, 130, 246, 0.2);
  --border-color: #334155;
  --sidebar-bg: #1e293b;
  --sidebar-active: #334155;
  --sidebar-text: #f8fafc;
  --sidebar-icon: #94a3b8;
  --topbar-bg: #1e293b;
  --bs-body-bg: #0f172a;
  --bs-body-color: #f8fafc;

  /* Sidebar en dark mode */
  --sidebar-hover-bg: #334155;
  --sidebar-active-bg: #475569;

  /* Fondo secundario en dark mode */
  --body-secondary-bg: #1e293b;
  --muted-color: #64748b;

  /* Separadores en dark mode */
  --separator-text-color: #64748b;
  --separator-line-color: #334155;

  /* Componente info-form en dark mode */
  --info-form-border: #475569;
  --info-form-text: #94a3b8;

  /* Paginación en dark mode */
  --pagination-btn-bg: #334155;
  --pagination-btn-color: #e2e8f0;
  --pagination-btn-disabled: #475569;

  /* Tabs en dark mode */
  --tab-inactive-color: #94a3b8;
  --tab-active-color: #93c5fd;
  --tab-border-color: #334155;
}

#wrapper #content-wrapper {
  background: var(--bs-body-bg, white);
}

/* Sidebar */
.sidebar,
.bg-gradient-primary,
.sidebar-dark {
  background: var(--sidebar-bg) !important;
  color: var(--sidebar-text) !important;
  border-right: 1px solid var(--border-color);
}

[data-bs-theme='dark'] .bg-gradient-primary {
  background: #0f172a !important;
  background-image: none !important;
}

.sidebar .sidebar-brand,
.sidebar .sidebar-heading {
  color: var(--sidebar-brand-color) !important;
  font-size: 1rem;
  font-weight: 700;
  padding: 1rem 0.5rem;
}

.sidebar .nav-item {
  margin-bottom: 0.1rem;
}

.sidebar .nav-link {
  color: var(--sidebar-text) !important;
  background: transparent !important;
  padding: 0.5rem 1rem;
  font-size: 0.97rem;
  border-radius: 6px;
  margin: 0.1rem 0.5rem;
  transition:
    background 0.15s,
    color 0.15s;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.sidebar .nav-link i {
  color: var(--sidebar-icon) !important;
  margin-right: 0.7em;
  font-size: 1.1em;
}

.sidebar .nav-link.active,
.sidebar .nav-link:active,
.sidebar .nav-link:focus,
.sidebar .nav-link:hover {
  background: var(--sidebar-active) !important;
  color: var(--main-accent) !important;
}

.sidebar .nav-link.active i,
.sidebar .nav-link:active i,
.sidebar .nav-link:focus i,
.sidebar .nav-link:hover i {
  color: var(--sidebar-active-icon) !important;
}

.sidebar .collapse-inner {
  background: var(--bs-body-bg, #fff);
  border-radius: 8px;
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.03);
  margin: 0.2rem 0;
}

.sidebar .collapse-item {
  color: var(--sidebar-text) !important;
  padding: 0.4rem 1.2rem;
  font-size: 0.95rem;
  border-radius: 5px;
}

.sidebar .collapse-item:hover,
.sidebar .collapse-item.active {
  background: var(--sidebar-active);
  color: var(--main-accent) !important;
}

/* --- Compact Sidebar --- */
.sidebar {
  font-size: 0.93rem !important;
  padding-top: 0.3rem !important;
}

.sidebar .sidebar-heading {
  font-size: 0.93rem !important;
  padding: 0.5rem 0.7rem 0.2rem 1rem !important;
  letter-spacing: 0.03em;
}

.sidebar .nav-item {
  margin-bottom: 0 !important;
}

.sidebar .nav-link {
  padding: 0.35rem 0.9rem !important;
  margin: 0.05rem 0.4rem !important;
  min-height: 30px !important;
  font-size: 0.93rem !important;
  border-radius: 5px !important;
  font-weight: 400 !important;
  transition:
    background 0.15s,
    color 0.15s;
}

.sidebar .nav-link i {
  font-size: 1em !important;
  margin-right: 0.5em !important;
}

.sidebar .nav-link:hover {
  background: var(--sidebar-hover-bg) !important;
  color: var(--sidebar-text) !important;
}

.sidebar .nav-link:active,
.sidebar .nav-link:focus {
  background: var(--sidebar-active-bg) !important;
  color: var(--sidebar-text) !important;
}

.sidebar .nav-link.active {
  background: var(--sidebar-active-bg) !important;
  color: var(--sidebar-accent-alt) !important;
  font-weight: 700 !important;
}

.sidebar .nav-link.active i {
  color: var(--sidebar-accent-alt) !important;
}

.sidebar .collapse-inner {
  padding: 0.2rem 0.2rem !important;
}

.sidebar .collapse-item {
  font-size: 0.92rem !important;
  padding: 0.3rem 1.1rem !important;
  border-radius: 4px !important;
}

.sidebar .collapse-item:hover {
  background: var(--sidebar-hover-bg) !important;
  color: var(--sidebar-text) !important;
}

.sidebar .collapse-item.active {
  background: var(--sidebar-active-bg) !important;
  color: var(--sidebar-accent-alt) !important;
  font-weight: 700 !important;
}

/* Topbar */
.navbar,
.topbar,
.bg-white {
  background: var(--topbar-bg) !important;
  border-bottom: 1px solid var(--border-color);
  min-height: 48px;
  padding: 0.2rem 1rem;
}

.navbar .navbar-nav .nav-link,
.topbar .navbar-nav .nav-link {
  color: var(--sidebar-text) !important;
  font-size: 0.97rem;
  padding: 0.3rem 0.8rem;
}

.navbar .navbar-nav .nav-link:hover,
.topbar .navbar-nav .nav-link:hover {
  color: var(--main-accent) !important;
}

/* Cards and containers */
.modal-content,
.form-group,
.table {
  background: var(--bs-body-bg, #fff);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.03);
  align-content: center;
}

/* Clases Juanma General */

.table-responsive > .dataTables_wrapper {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: 36px 36px 1fr;
  grid-template-areas:
    'b e'
    'd a'
    'c c';
  gap: 0.5rem;
  align-items: center;
  font-size: 0.9rem;

  &:not(:has(.dataTables_filter)) {
    grid-template-areas:
      'e e'
      'd a'
      'c c';

    & > .dataTables_paginate {
      justify-content: flex-start;
    }
  }

  & > .dataTables_length {
    grid-area: a;

    & > label {
      margin: 0;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      justify-content: flex-end;

      & > select:focus-visible {
        outline: none;
      }
    }
  }

  & > .dataTables_filter {
    grid-area: b;

    & > label {
      margin: 0;
      display: flex;
      align-items: center;
      gap: 0.5rem;

      & > input {
        flex-grow: 1;
        flex-shrink: 0;
        flex-basis: 200px;
        margin: 0;
        padding: 0.35rem 0.7rem;
        color: var(--sidebar-text);
        border-radius: 6px;
        border: 1px solid var(--border-color);
        transition: border 0.2s;

        &:focus {
          border-color: var(--main-accent);
          box-shadow: 0 0 0 2px var(--main-accent-light);
        }

        &:focus-visible {
          outline: none;
        }
      }
    }
  }

  & > table {
    grid-area: c;
    margin: 0 !important;
    border-collapse: collapse !important;
    box-shadow: none;
    width: 100% !important;

    & > thead > tr > th {
      position: relative;
      width: auto;
      white-space: nowrap;

      &::before,
      &::after {
        position: absolute;
        height: 25px;
        top: 50% !important;
        transform: translateY(-50%);
      }
    }

    & > thead > tr > th,
    & > tbody > tr > td {
      text-align: center;
      vertical-align: middle;
    }

    & > tbody > tr > td:last-child > div {
      display: flex;
      justify-content: center;
      align-content: center;
      gap: 1rem;

      & > a {
        width: 15px;
        height: 15px;
      }
    }
  }

  & > .dataTables_info {
    grid-area: d;
    text-align: left;
    padding: 0;
  }

  & > .dataTables_paginate {
    grid-area: e;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.2rem;
    margin: 0 1px;

    & .paginate_button {
      cursor: pointer;
      display: inline-block;
      padding: 0.1rem 0.5rem;
      border-radius: 5px;
      font-weight: 500;
      background: var(--pagination-btn-bg);
      color: var(--pagination-btn-color) !important;
      transition: all 0.3s ease;
    }

    & > span > a {
      margin: 0 0.2rem;
    }

    & .paginate_button:hover {
      outline: 1px solid var(--main-accent-hover);
    }

    & .paginate_button.current {
      border-bottom: 2px solid var(--sidebar-text);
    }

    & .paginate_button.disabled {
      color: var(--pagination-btn-disabled) !important;
      cursor: default;
      pointer-events: none;
    }
  }
}

.filter-row {
  & * {
    min-width: 100px;

    & > input {
      color: var(--sidebar-text) !important;
    }
  }
}

.only-table > .dataTables_wrapper {
  display: block;

  & > div {
    display: none;
  }
}

/* Clases Juanma Dashboard */

.dashboard-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0;

  & > div {
    flex-grow: 1;
    flex-shrink: 0;
    flex-basis: 170px;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 0.125rem 0.25rem 0 rgba(58, 59, 69, 0.2);
    font-weight: 700;

    &:nth-child(1) {
      color: var(--vuln-cri);
      border-left: 0.3rem solid var(--vuln-cri);
    }

    &:nth-child(2) {
      color: var(--vuln-hig);
      border-left: 0.3rem solid var(--vuln-hig);
    }

    &:nth-child(3) {
      color: var(--vuln-med);
      border-left: 0.3rem solid var(--vuln-med);
    }

    &:nth-child(4) {
      color: var(--vuln-low);
      border-left: 0.3rem solid var(--vuln-low);
    }

    &:nth-child(5) {
      color: var(--vuln-inf);
      border-left: 0.3rem solid var(--vuln-inf);
    }
  }

  & > div > p {
    margin: 0;
    margin-left: 0.3rem;

    &:first-child {
      text-transform: uppercase;
      font-size: 0.7rem;
    }

    &:last-child {
      font-size: 1.1rem;
    }
  }
}

/* Clases Juanma Project-details */

.information-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: center;
  gap: 1rem;

  & > * {
    padding: 0.5rem 1.2rem;
    border-bottom: 2.5px solid var(--border-color);

    & > * {
      margin: 0;

      &:first-child {
        display: flex;
        align-items: center;
        gap: 1rem;

        & > p {
          margin: 0;
          color: white;
          font-size: 0.8rem;
          font-weight: 500;
        }
      }

      &:last-child {
        font-size: 14px;
        color: black;
      }
    }
  }
}

.state-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;

  & > div {
    flex-grow: 1;
    flex-shrink: 0;
    flex-basis: 370px;
  }

  & > div > h4 {
    font-size: 1.3rem;
  }

  & > div > p {
    margin: 0;
  }
}

.state-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  color: white;
  font-size: 1rem;

  & > * {
    padding: 0.4rem;
    align-content: center;

    &:nth-child(1) {
      background: var(--vuln-cri);
    }

    &:nth-child(2) {
      background: var(--vuln-hig);
    }

    &:nth-child(3) {
      background: var(--vuln-med);
    }

    &:nth-child(4) {
      background: var(--vuln-low);
    }

    &:nth-child(5) {
      color: var(--vuln-inf);
      border: 2px solid var(--vuln-inf);
      background: white;
    }
  }
}

.quality-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;

  & > * {
    flex-grow: 1;
    flex-shrink: 0;
    flex-basis: 210px;
    display: flex;
    justify-content: space-between;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 0.125rem 0.25rem 0 rgba(58, 59, 69, 0.2);
    font-weight: 700;

    & :first-child {
      margin-left: 0.3rem;
      align-content: center;

      & > * {
        margin: 0;

        &:first-child {
          text-transform: uppercase;
          font-size: 0.7rem;
        }

        &:last-child {
          font-size: 1.1rem;
          color: #5a5c69;
        }
      }
    }

    & :last-child {
      justify-items: center;
      align-content: center;
      color: #dddfeb;
    }
  }
}

.btn-filters {
  display: flex;
  justify-items: center;
  align-items: center;

  & > button {
    color: var(--sidebar-text);
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    height: 100%;
    padding: 0.35rem 0.7rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;

    &:last-child {
      border-radius: 0 6px 6px 0;
    }

    &:hover {
      cursor: pointer;
      background-color: #ececec;
    }

    &.active {
      background-color: #909090;
      color: white;
    }
  }
}

/* Clases Juanma Configurations */

.title-add {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  margin-bottom: 1rem;
  padding: 0.3rem 0.6rem;
  font-weight: 500;
  white-space: nowrap;
  color: #232629;
  opacity: 0.7;
  border: 2px solid #232629;
  border-radius: 10px;
  transition:
    color 0.2s,
    opacity 0.2s,
    font-weight 0.2s;

  &:hover {
    cursor: pointer;
    color: #232629;
    opacity: 1;
    font-weight: 500;
  }
}

.crud-images {
  color: #232629;
  opacity: 0.7;

  &:hover {
    cursor: pointer;
    color: #232629;
    opacity: 1;
  }
}

.general-configurations {
  & .card-header > h6 {
    white-space: nowrap;
  }

  & .card-body > form {
    & > div {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      margin-bottom: 0.5rem;

      & > div {
        flex-grow: 1;
        flex-shrink: 0;
        flex-basis: 200px;
      }
    }
  }
}

/* Clases Juanma Forms */

.separator {
  display: flex;
  align-items: center;
  color: var(--separator-text-color);

  & > hr {
    flex: 1;
    border: none;
    height: 2px;
    background-color: var(--separator-line-color);
  }

  & > span {
    font-size: 1rem;
    padding: 0 2rem;
    white-space: nowrap;
  }
}

.info-form {
  display: flex;
  justify-items: center;
  align-items: center;
  gap: 0.25rem;
  font-size: 80%;
  margin: 0;

  & > div {
    position: relative;
    text-align: center;
    border: 2px solid var(--info-form-border);
    border-radius: 50%;
    width: 15px;
    height: 15px;

    & > i {
      position: absolute;
      top: 1px;
      left: 3.8px;
      color: var(--info-form-border);
    }
  }

  & > span {
    color: var(--info-form-text);
  }
}

.div-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;

  & > div {
    flex-grow: 1;
    flex-shrink: 0;
    flex-basis: 260px;
  }
}

.button-form {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

.access-group-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: flex-start;

  & > div {
    flex: 1 0 250px;

    &:last-child {
      flex: 0 0 110px;
      align-self: flex-end;

      & > * {
        white-space: nowrap;
      }
    }
  }
}

/* Modern Icon Shapes */
.icon-shape {
  width: 3rem;
  height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
}
.bg-primary-soft {
  background-color: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}
.bg-success-soft {
  background-color: rgba(16, 185, 129, 0.15);
  color: #10b981;
}
.bg-warning-soft {
  background-color: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}
.bg-info-soft {
  background-color: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
}
.bg-orange-soft {
  background-color: rgba(249, 115, 22, 0.15);
  color: #f97316;
}
.bg-violet-soft {
  background-color: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
}

/* Role Badges */
.badge-role-superadmin {
  background-color: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
}
.badge-role-licenseadmin {
  background-color: rgba(59, 130, 246, 0.15) !important;
  color: #3b82f6 !important;
  border: 1px solid rgba(59, 130, 246, 0.4) !important;
}
.badge-role-readonly {
  background-color: rgba(107, 114, 128, 0.15) !important;
  color: #6b7280 !important;
  border: 1px solid rgba(107, 114, 128, 0.4) !important;
}

/* Status Badges */
.badge-soft-primary {
  background-color: rgba(59, 130, 246, 0.15) !important;
  color: #3b82f6 !important;
  border: 1px solid rgba(59, 130, 246, 0.4) !important;
}
.badge-soft-success {
  background-color: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
}
.badge-soft-danger {
  background-color: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
}
.badge-soft-secondary {
  background-color: rgba(107, 114, 128, 0.15) !important;
  color: #6b7280 !important;
  border: 1px solid rgba(107, 114, 128, 0.4) !important;
}

[data-bs-theme='dark'] .badge-role-superadmin {
  border-color: rgba(239, 68, 68, 0.6) !important;
}
[data-bs-theme='dark'] .badge-role-licenseadmin {
  border-color: rgba(59, 130, 246, 0.6) !important;
}
[data-bs-theme='dark'] .badge-role-readonly {
  border-color: rgba(156, 163, 175, 0.6) !important;
  color: #9ca3af !important;
}
[data-bs-theme='dark'] .badge-soft-primary {
  border-color: rgba(59, 130, 246, 0.6) !important;
}
[data-bs-theme='dark'] .badge-soft-success {
  border-color: rgba(16, 185, 129, 0.6) !important;
}
[data-bs-theme='dark'] .badge-soft-danger {
  border-color: rgba(239, 68, 68, 0.6) !important;
}
[data-bs-theme='dark'] .badge-soft-secondary {
  border-color: rgba(156, 163, 175, 0.6) !important;
  color: #9ca3af !important;
}

/* Soft Buttons */
.btn-soft-info {
  background-color: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.btn-soft-info:hover {
  background-color: #06b6d4;
  color: #fff;
}

.btn-soft-secondary {
  background-color: rgba(107, 114, 128, 0.15);
  color: #6b7280;
  border: 1px solid rgba(107, 114, 128, 0.3);
}
.btn-soft-secondary:hover {
  background-color: #6b7280;
  color: #fff;
}

.btn-soft-success {
  background-color: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.btn-soft-success:hover {
  background-color: #10b981;
  color: #fff;
}

.btn-soft-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-soft-danger:hover {
  background-color: #ef4444;
  color: #fff;
}

.btn-soft-warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.btn-soft-warning:hover {
  background-color: #f59e0b;
  color: #fff;
}

[data-bs-theme='dark'] .btn-soft-info {
  border-color: rgba(6, 182, 212, 0.5);
}
[data-bs-theme='dark'] .btn-soft-secondary {
  border-color: rgba(156, 163, 175, 0.5);
  color: #9ca3af;
}
[data-bs-theme='dark'] .btn-soft-success {
  border-color: rgba(16, 185, 129, 0.5);
}
[data-bs-theme='dark'] .btn-soft-danger {
  border-color: rgba(239, 68, 68, 0.5);
}
[data-bs-theme='dark'] .btn-soft-warning {
  border-color: rgba(245, 158, 11, 0.5);
}

[data-bs-theme='dark'] .bg-primary-soft {
  background-color: rgba(59, 130, 246, 0.25) !important;
  color: #93c5fd !important;
}
[data-bs-theme='dark'] .bg-success-soft {
  background-color: rgba(16, 185, 129, 0.25) !important;
  color: #34d399 !important;
}
[data-bs-theme='dark'] .bg-warning-soft {
  background-color: rgba(245, 158, 11, 0.25) !important;
  color: #fbbf24 !important;
}
[data-bs-theme='dark'] .bg-info-soft {
  background-color: rgba(6, 182, 212, 0.25) !important;
  color: #22d3ee !important;
}
[data-bs-theme='dark'] .bg-orange-soft {
  background-color: rgba(249, 115, 22, 0.25) !important;
  color: #fb923c !important;
}
[data-bs-theme='dark'] .bg-violet-soft {
  background-color: rgba(139, 92, 246, 0.25) !important;
  color: #a78bfa !important;
}

/* Environment badge in dashboard activations mini-card */
.badge-env {
  background-color: #e5e7eb;
  color: #374151;
  border-color: #d1d5db !important;
  font-weight: 600;
}
[data-bs-theme='dark'] .badge-env {
  background-color: rgba(75, 85, 99, 0.4);
  color: #d1d5db;
  border-color: rgba(107, 114, 128, 0.5) !important;
}

/* Dashboard mini-tables dark mode: expiring licenses date and key */
[data-bs-theme='dark'] .card-soft-orange .text-danger,
[data-bs-theme='dark'] .card-soft-orange .text-primary {
  color: #d1d5db !important;
}
[data-bs-theme='dark'] .card-soft-violet .text-muted {
  color: #9ca3af !important;
}

/* Logout button: always solid red, lighter red on hover */
.btn-logout {
  background-color: #ef4444;
  color: #fff !important;
  border-color: #ef4444;
}
.btn-logout:hover {
  background-color: #f87171;
  border-color: #f87171;
  color: #fff !important;
}
[data-bs-theme='dark'] .btn-logout {
  background-color: #dc2626;
  border-color: #dc2626;
}
[data-bs-theme='dark'] .btn-logout:hover {
  background-color: #ef4444;
  border-color: #ef4444;
}

/* Dashboard dark mode: fill outline buttons with their solid color */
[data-bs-theme='dark'] .card-soft-primary .btn-outline-primary {
  background-color: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}
[data-bs-theme='dark'] .card-soft-primary .btn-outline-primary:hover {
  background-color: #60a5fa;
  border-color: #60a5fa;
}
[data-bs-theme='dark'] .card-soft-success .btn-outline-success {
  background-color: #10b981;
  color: #fff;
  border-color: #10b981;
}
[data-bs-theme='dark'] .card-soft-success .btn-outline-success:hover {
  background-color: #34d399;
  border-color: #34d399;
}

.text-orange {
  color: #f97316 !important;
}
.text-violet {
  color: #8b5cf6 !important;
}

/* Dashboard Card Soft Colors */
.card-soft-primary {
  background-color: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  border-left: 5px solid #3b82f6 !important;
}
.card-soft-success {
  background-color: #f0fdf4 !important;
  border: 1px solid #bbf7d0 !important;
  border-left: 5px solid #10b981 !important;
}
.card-soft-warning {
  background-color: #fffbeb !important;
  border: 1px solid #fde68a !important;
  border-left: 5px solid #f59e0b !important;
}
.card-soft-orange {
  background-color: #fff7ed !important;
  border: 1px solid #ffedd5 !important;
  border-left: 5px solid #f97316 !important;
}
.card-soft-secondary {
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-left: 5px solid #94a3b8 !important;
}
.card-soft-violet {
  background-color: #f5f3ff !important;
  border: 1px solid #ede9fe !important;
  border-left: 5px solid #8b5cf6 !important;
}

/* Dark Mode Overrides for Soft Cards */
[data-bs-theme='dark'] .card-soft-primary {
  background-color: rgba(59, 130, 246, 0.1) !important;
  border: 1px solid rgba(59, 130, 246, 0.2) !important;
  border-left: 5px solid #3b82f6 !important;
}
[data-bs-theme='dark'] .card-soft-success {
  background-color: rgba(16, 185, 129, 0.1) !important;
  border: 1px solid rgba(16, 185, 129, 0.2) !important;
  border-left: 5px solid #10b981 !important;
}
[data-bs-theme='dark'] .card-soft-warning {
  background-color: rgba(245, 158, 11, 0.1) !important;
  border: 1px solid rgba(245, 158, 11, 0.2) !important;
  border-left: 5px solid #f59e0b !important;
}
[data-bs-theme='dark'] .card-soft-orange {
  background-color: rgba(249, 115, 22, 0.1) !important;
  border: 1px solid rgba(249, 115, 22, 0.2) !important;
  border-left: 5px solid #f97316 !important;
}
[data-bs-theme='dark'] .card-soft-secondary {
  background-color: rgba(148, 163, 184, 0.1) !important;
  border: 1px solid rgba(148, 163, 184, 0.2) !important;
  border-left: 5px solid #94a3b8 !important;
}
[data-bs-theme='dark'] .card-soft-violet {
  background-color: rgba(139, 92, 246, 0.1) !important;
  border: 1px solid rgba(139, 92, 246, 0.2) !important;
  border-left: 5px solid #8b5cf6 !important;
}

/* Dark mode: override colored text in cards to light grey for readability */
[data-bs-theme='dark'] .card-soft-primary .text-primary,
[data-bs-theme='dark'] .card-soft-success .text-success,
[data-bs-theme='dark'] .card-soft-orange .text-orange,
[data-bs-theme='dark'] .card-soft-violet .text-violet {
  color: #d1d5db !important;
}

/* Add padding to the card body of soft cards */
.card-soft-primary .card-body,
.card-soft-success .card-body,
.card-soft-warning .card-body,
.card-soft-orange .card-body,
.card-soft-secondary .card-body,
.card-soft-violet .card-body {
  padding: 1.5rem;
}

/* Buttons */
.btn,
.btn-primary,
.btn-success,
.btn-orange,
.btn-violet,
.btn-logout { /* Añadido btn-logout aquí para heredar la base */
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  padding: 0.4rem 1.2rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn:hover,
.btn-primary:hover,
.btn-success:hover,
.btn-orange:hover,
.btn-violet:hover,
.btn-logout:hover { /* Añadido hover base */
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.15),
    0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

/* Intermediate base colors */
.btn-primary {
  background-color: #60a5fa !important;
  border-color: #60a5fa !important;
  color: #fff !important;
}
.btn-success {
  background-color: #34d399 !important;
  border-color: #34d399 !important;
  color: #fff !important;
}
.btn-orange {
  background-color: #fb923c !important;
  border-color: #fb923c !important;
  color: #fff !important;
}
.btn-violet {
  background-color: #a78bfa !important;
  border-color: #a78bfa !important;
  color: #fff !important;
}

.btn-logout {
  background-color: #e74a3b !important; 
  border-color: #e74a3b !important;
  color: #fff !important;
  border: none;
}

/* Solid hover colors (match titles) */
.btn-primary:hover {
  background-color: #3b82f6 !important;
  border-color: #3b82f6 !important;
}
.btn-success:hover {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
}
.btn-orange:hover {
  background-color: #f97316 !important;
  border-color: #f97316 !important;
}
.btn-violet:hover {
  background-color: #8b5cf6 !important;
  border-color: #8b5cf6 !important;
}


.btn-logout:hover {
  background-color: #be2617 !important; 
  border-color: #be2617 !important;
  transform: translateY(-1px); 
}
/* Inputs */
.form-control,
.form-select,
input[type='text'],
input[type='date'],
select {
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--sidebar-text);
  font-size: 0.9rem;
  padding: 0.35rem 0.7rem;
  min-height: 34px;
  transition: border 0.2s;
}

.form-control[readonly],
.form-control:disabled {
  background-color: #f8f9fc !important;
  opacity: 1;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--main-accent);
  background: #fff;
  box-shadow: 0 0 0 2px var(--main-accent-light);
}

select:hover {
  cursor: pointer;
}

.input-group-text {
  background: var(--body-secondary-bg);
  border: 1px solid var(--border-color);
  color: var(--muted-color);
  font-size: 0.9rem;
  border-radius: 6px 0 0 6px;
  padding: 0.35rem 0.7rem;
}

/* Table */
.table {
  color: var(--sidebar-text);
  background: var(--bs-body-bg, #fff);
  font-size: 0.97rem;
}

.table th,
.table td {
  border-color: var(--border-color);
  padding: 0.5rem 0.7rem;
}

.table-striped tbody tr:nth-of-type(odd) {
  background: var(--body-secondary-bg);
}

.table-hover tbody tr:hover {
  background: #e6f4f1;
}

.table thead,
.table tbody {
  font-size: 0.9rem;
}

/* Alerts */
.alert-info {
  background: #e6f4f1;
  color: var(--alert-info);
  border-color: var(--alert-info);
}

.alert-success {
  background: #e6f9f2;
  color: var(--alert-success);
  border-color: var(--alert-success);
}

.alert-warning {
  background: #fffbe6;
  color: var(--alert-warning);
  border-color: var(--alert-warning);
}

.alert-danger {
  background: #fff0f0;
  color: var(--alert-danger);
  border-color: var(--alert-danger);
}

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--sidebar-text);
  font-weight: 600;
  margin: 0;
}

h1 {
  font-size: 1.7rem;
}

h4 {
  font-size: 1.3rem;
}

/* Links */
a {
  color: var(--main-accent);
  text-decoration: none;

  &:hover {
    color: var(--main-accent-hover);
    text-decoration: none;
  }
}

/* Misc */
hr {
  border-color: var(--border-color);
}

footer.sticky-footer {
  background: var(--body-secondary-bg);
  border-top: 1px solid var(--border-color);
  color: var(--muted-color);
  font-size: 0.95rem;
  padding: 0.5rem 0;
}

/* Compact spacing for forms and cards */

#genericModal {
  & #genericModalHeader {
    padding: 1rem;
  }

  & #genericModalBody {
    padding: 2.5rem 3rem;
  }
}

.card-body,
.form-group,
.modal-body {
  padding: 1rem;
}

.card-header,
.modal-header {
  padding: 0.6rem 1rem;
  background: var(--body-secondary-bg);
  border-bottom: 1px solid var(--border-color);
}

/* Dropdowns and menus */
.dropdown-menu {
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 0.97rem;
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.07);
}

.dropdown-item {
  padding: 0.4rem 1.2rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--main-accent-light);
  color: var(--main-accent);
}

/* Profile image */
.img-profile {
  height: 2rem;
  width: 2rem;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

/* Scroll to top button */
.scroll-to-top {
  background: var(--main-accent);
  color: #fff;
  border-radius: 50%;
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1.2rem;
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.07);
}

.scroll-to-top:hover {
  background: var(--main-accent-hover);
  color: #fff;
}

/* Remove heavy box-shadows from cards for a flatter look */
.modal-content {
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.03) !important;
  min-width: 356px;
}

/* ============================================================
   CLASES UTILITARIAS — Reemplazan estilos en línea en los HTML
   ============================================================ */

/* login.html: centrado vertical de la tarjeta de login */
.login-center-wrapper {
  margin-top: 10%;
}

/* layout.html: etiqueta de usuario en botón logout (topbar) */
.topbar-username-label {
  font-size: 0.65rem;
  letter-spacing: 0.02em;
}

/* error.html: bloque de trace técnico con scroll */
.error-trace-scroll {
  max-height: 250px;
  overflow-y: auto;
}

/* Tablas compactas (dashboard, licenses-detail, customers-detail, audit-list) */
.table-sm-text {
  font-size: 0.85rem;
}

/* licenses-list.html: columna ID estrecha */
.col-id-narrow {
  width: 80px;
}

/* customers-form.html: texto de badge de estado en edición */
.badge-status-text {
  font-size: 0.9rem;
}

/* ============================================================
   TABS (Detail Views & List Views) — Definición consolidada
   ============================================================ */
.openai-tabs {
  display: flex;
  position: relative;
  border-bottom: 1px solid var(--tab-border-color);
  background: transparent;
  gap: 2rem;
  margin-bottom: 0;
}

.openai-tab {
  background: none;
  border: none;
  outline: none;
  color: var(--tab-inactive-color);
  font-size: 1rem;
  font-weight: 600;
  opacity: 1;
  padding: 0.75rem 0;
  margin: 0;
  cursor: pointer;
  position: relative;
  transition: color 0.3s;
  border-radius: 0;
  white-space: nowrap;
}

.openai-tab:not(.active):hover,
.openai-tab.active {
  color: var(--tab-active-color);
}

.openai-tab-indicator {
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: var(--tab-active-color);
  border-radius: 2px 2px 0 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0;
  opacity: 0;
  will-change: width, transform;
  z-index: 2;
  pointer-events: none;
}

.tab-content {
  margin-bottom: 2rem;
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .sidebar {
    font-size: 0.95rem;
    width: 4.5rem !important;
  }

  .sidebar .sidebar-brand {
    padding: 1.5rem 0 !important;
  }

  .sidebar .sidebar-brand-text {
    display: none !important;
  }

  .sidebar .sidebar-heading {
    display: none !important;
  }

  .sidebar .nav-item {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .sidebar .nav-link {
    justify-content: center !important;
    padding: 0 !important;
    margin: 0.2rem 0 !important;
    width: 2.8rem !important;
    height: 2.8rem !important;
    border-radius: 8px !important;
  }

  .sidebar .nav-link i {
    margin-right: 0 !important;
    font-size: 1.3rem !important;
  }

  .sidebar .nav-link span {
    display: none !important;
  }

  .navbar,
  .topbar {
    font-size: 0.95rem;
    padding: 0.1rem 0.5rem;
  }
}

/* ============================================================
   DARK MODE CORRECTIONS
   ============================================================ */

/* H1/H2/H3 page titles: lighter grey in dark mode */
[data-bs-theme='dark'] .text-gray-900,
[data-bs-theme='dark'] h1.h3,
[data-bs-theme='dark'] .h3 {
  color: #e2e8f0 !important;
}

/* Customer code column: lighter text in dark mode */
[data-bs-theme='dark'] .text-dark {
  color: #cbd5e1 !important;
}

[data-bs-theme='dark'] .border {
  border-color: #334155 !important;
}

/* Filter cards (bg-body-tertiary) in dark mode */
[data-bs-theme='dark'] .bg-body-tertiary {
  background-color: #1e293b !important;
  border: 1px solid #334155;
}
/* Global Form Controls in Dark Mode */
[data-bs-theme='dark'] .form-control,
[data-bs-theme='dark'] .form-select,
[data-bs-theme='dark'] .input-group-text {
  background-color: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}
[data-bs-theme='dark'] .form-control::placeholder {
  color: #64748b;
}
[data-bs-theme='dark'] .form-control:focus,
[data-bs-theme='dark'] .form-select:focus {
  background-color: #0f172a;
  border-color: #3b82f6;
  color: #e2e8f0;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

[data-bs-theme='dark'] .form-control[readonly],
[data-bs-theme='dark'] .form-control:disabled {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #cbd5e1 !important;
}

/* Filter action buttons: Filtrar → dark text; Limpiar → light grey text in dark mode */
[data-bs-theme='dark'] .bg-body-tertiary .btn-secondary {
  color: #1e293b !important;
}
[data-bs-theme='dark'] .bg-body-tertiary .btn-outline-secondary {
  color: #cbd5e1 !important;
  border-color: #64748b !important;
}

/* Breadcrumb links: white in dark mode */
[data-bs-theme='dark'] .breadcrumb-item a {
  color: #e2e8f0 !important;
  text-decoration: none;
}
[data-bs-theme='dark'] .breadcrumb-item a:hover {
  color: #ffffff !important;
  text-decoration: underline;
}
[data-bs-theme='dark'] .breadcrumb-item.active {
  color: #94a3b8 !important;
}
[data-bs-theme='dark'] .breadcrumb-item + .breadcrumb-item::before {
  color: #64748b;
}

/* Sort icons (fa-sort, fa-sort-up, fa-sort-down) in table headers: visible in dark mode */
/* Dark mode: Table Headers (thead-light) and Sort Icons */
[data-bs-theme='dark'] thead.thead-light th {
  background-color: #334155 !important;
  color: #f8fafc !important;
  border-color: #475569 !important;
}

[data-bs-theme='dark'] th.sortable .fa-sort {
  color: #94a3b8 !important;
  opacity: 0.6;
}

[data-bs-theme='dark'] th.sortable .fa-sort-up,
[data-bs-theme='dark'] th.sortable .fa-sort-down {
  color: #93c5fd !important;
  opacity: 1;
}

/* Licenses table: uniform square action buttons */
#licensesTableBody .btn-group .btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

/* Fixes for Forms in Dark Mode */
[data-bs-theme='dark'] .card-footer.bg-white,
[data-bs-theme='dark'] .card-header.bg-white {
  background-color: transparent !important;
  border-color: #334155;
}

[data-bs-theme='dark'] .btn-light {
  background-color: #334155;
  color: #f8fafc;
  border-color: #475569;
}
[data-bs-theme='dark'] .btn-light:hover {
  background-color: #475569;
  color: #ffffff;
}

[data-bs-theme='dark'] .btn-secondary {
  color: #1e293b !important;
}

/* Dark mode: generic cards and headers (fixes white parts in dashboard charts) */
[data-bs-theme='dark'] .card {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

[data-bs-theme='dark'] .card-header {
  background-color: rgba(255, 255, 255, 0.03) !important;
  border-bottom-color: #334155 !important;
}

/* Global blue text refinement for dark mode */
[data-bs-theme='dark'] .text-primary,
[data-bs-theme='dark'] h6.text-primary {
  color: #93c5fd !important;
}

/* Dark mode: Modal Overrides */
[data-bs-theme='dark'] .modal-content {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
}

[data-bs-theme='dark'] .modal-header {
  background-color: #1e293b !important;
  border-bottom-color: #334155 !important;
}

[data-bs-theme='dark'] .modal-footer {
  border-top-color: #334155 !important;
}

[data-bs-theme='dark'] #tab-activations h6.text-success {
  color: #93c5fd !important;
}

[data-bs-theme='dark'] .modal-body.text-gray-800 {
  color: #e2e8f0 !important;
}

[data-bs-theme='dark'] .bg-light {
  background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Ensure the close button (btn-close) is visible in dark mode modals */
[data-bs-theme='dark'] .modal-header .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* Dark mode: OpenAI Tabs Refinement */
[data-bs-theme='dark'] .openai-tab {
  color: #cbd5e1 !important;
}

[data-bs-theme='dark'] .openai-tab:hover {
  color: #ffffff !important;
}

[data-bs-theme='dark'] .openai-tab.active {
  color: #93c5fd !important;
}

[data-bs-theme='dark'] .openai-tab-indicator {
  background: #93c5fd !important;
}

.tab-content-pane {
  animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   SORTABLE HEADERS
   ============================================================ */
th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable:hover {
  background-color: #f1f3f6;
}
[data-bs-theme='dark'] th.sortable:hover {
  background-color: #475569 !important;
}

/* Dark mode: Striped Tables and Hover fix */
[data-bs-theme='dark'] .table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(255, 255, 255, 0.02) !important;
}

[data-bs-theme='dark'] .table-hover tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #f8fafc !important;
}

/* Dark mode: Badge light and text-dark fixes for Edition and Action columns */
[data-bs-theme='dark'] .badge.badge-light.text-dark {
  background-color: #334155 !important;
  color: #f8fafc !important;
  border-color: #475569 !important;
}
