:root {
  --app-primary: #2a6f6b;
  --app-primary-dark: #1f5552;
  --app-teal: #3d8b83;
  --app-sage: #5a7d6c;
  --app-heading: #1e3a3a;
  --app-guest-bg: #f4f8f7;
  --app-radius: 0.5rem;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.text-app-heading {
  color: var(--app-heading);
}

.bg-app-guest {
  background-color: var(--app-guest-bg);
}

.btn-app-primary {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
  color: #fff !important;
}

.btn-app-primary:hover,
.btn-app-primary:focus,
.btn-app-primary:active {
  background-color: var(--app-primary-dark);
  border-color: var(--app-primary-dark);
  color: #fff !important;
}

/* Enlaces con apariencia de botón (AdminLTE / Bootstrap): evitar color de enlace sobre el fondo de marca */
.content-wrapper a.btn.btn-app-primary,
.content-wrapper a.btn.btn-app-primary.btn-sm,
.card-app .card-header a.btn.btn-app-primary {
  color: #fff !important;
}

.content-wrapper a.btn.btn-app-primary .fas,
.content-wrapper a.btn.btn-app-primary .far,
.card-app .card-header a.btn.btn-app-primary .fas {
  color: inherit !important;
}

/* Botón Expediente en barra de consulta: contorno visible con marca */
.btn-expediente-consulta {
  color: var(--app-primary);
  background-color: #fff;
  border: 2px solid var(--app-primary);
  font-weight: 600;
}

.btn-expediente-consulta:hover,
.btn-expediente-consulta:focus {
  color: #fff;
  background-color: var(--app-primary);
  border-color: var(--app-primary);
}

.btn-expediente-consulta:active {
  color: #fff;
  background-color: var(--app-primary-dark);
  border-color: var(--app-primary-dark);
}

/* Tablas: acciones solo icono (resultados, etc.) */
.btn-icon-table {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.35rem;
  font-size: 0.8125rem;
  line-height: 1;
  border-width: 1px;
  border-style: solid;
  vertical-align: middle;
}

.btn-icon-table-xs {
  width: 1.65rem;
  height: 1.65rem;
  font-size: 0.72rem;
}

.btn-icon-table:focus {
  box-shadow: 0 0 0 0.15rem rgba(42, 111, 107, 0.2);
  outline: none;
}

.btn-icon-view {
  color: var(--app-heading);
  background: #fff;
  border-color: #c5d4e0;
}

.btn-icon-view:hover {
  color: var(--app-primary);
  border-color: var(--app-primary);
  background: rgba(42, 111, 107, 0.06);
}

.btn-icon-secondary {
  color: #4a5a63;
  background: #fff;
  border-color: #c5d4e0;
}

.btn-icon-secondary:hover {
  color: var(--app-heading);
  border-color: #9db0bf;
  background: #f3f6f9;
}

.btn-icon-edit {
  color: var(--app-primary);
  background: rgba(42, 111, 107, 0.07);
  border-color: rgba(42, 111, 107, 0.45);
}

.btn-icon-edit:hover {
  color: #fff;
  background: var(--app-primary);
  border-color: var(--app-primary);
}

.btn-icon-delete {
  color: #a53030;
  background: rgba(165, 48, 48, 0.06);
  border-color: rgba(165, 48, 48, 0.38);
}

.btn-icon-delete:hover {
  color: #fff;
  background: #a53030;
  border-color: #a53030;
}

.table-acciones-compactas td {
  vertical-align: middle;
}

.rounded-app {
  border-radius: var(--app-radius);
}

.card-app {
  border-color: rgba(42, 111, 107, 0.15);
}

.layout-fixed .main-sidebar {
  background-color: var(--app-primary-dark) !important;
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active,
.sidebar-dark-primary .nav-sidebar > .nav-item.menu-open > .nav-link,
.main-sidebar .brand-link,
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

.table-clinica thead th {
  border-top: 0;
  color: var(--app-heading);
  font-weight: 600;
  font-size: 0.875rem;
}

.form-control:focus {
  border-color: rgba(42, 111, 107, 0.55);
  box-shadow: 0 0 0 0.15rem rgba(42, 111, 107, 0.18);
}

.badge-estado {
  font-weight: 500;
  font-size: 0.75rem;
}

/* Marca de agua (logo contorno) en el área principal autenticada */
.content-brand-watermark {
  position: relative;
  background-color: #f7faf9;
}

.content-brand-watermark::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/images/logo-contorno.png") center 42% no-repeat;
  background-size: min(480px, 58vw);
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
}

.content-brand-watermark .content-header,
.content-brand-watermark .content {
  position: relative;
  z-index: 1;
}

/* Marca sidebar: AdminLTE usa .brand-image (float) + .brand-text; overflow:hidden del tema recortaba el logo */
body.layout-navbar-fixed .wrapper .sidebar-brand-panel > .brand-link.sidebar-brand-link,
.sidebar-brand-panel > .brand-link.sidebar-brand-link {
  overflow: visible !important;
}

.sidebar-brand-panel .brand-link.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background-color: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 1rem;
  line-height: 1.25;
}

.sidebar-brand-panel .brand-link.sidebar-brand-link .brand-text {
  color: rgba(255, 255, 255, 0.95) !important;
  font-size: inherit;
  line-height: inherit;
  white-space: nowrap;
}

/* Mismo criterio visual que el logo del pie (ajusta contrast / opacity aquí) */
.sidebar-logo-header {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 0.25rem;
}

.sidebar-brand-panel .brand-link.sidebar-brand-link .brand-text {
  margin-left: 0 !important;
}

.layout-fixed .main-sidebar .sidebar {
  overflow-y: auto;
}

.sidebar-footer-border {
  border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.sidebar-logo-footer {
  display: block;
  max-height: 56px;
  max-width: 82%;
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.88;
}

/* Pantalla login / identidad (panel dividido, Bootstrap 5 en _LayoutLogin) */
.login-page-body {
  margin: 0;
  min-height: 100vh;
  background: var(--app-guest-bg);
}

.login-brand-card {
  overflow: hidden;
  border-radius: 0.6rem;
}

.login-brand-left {
  flex: 0 0 30%;
  max-width: 30%;
  background: #f8f9fa;
  border-right: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-brand-right {
  flex: 0 0 70%;
  max-width: 70%;
  padding: 1.5rem 1.5rem 1.75rem;
}

.login-brand-image {
  width: 100%;
  max-width: 320px;
  height: auto;
  object-fit: contain;
}

.btn-login-primary {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
  color: #fff;
}

.btn-login-primary:hover,
.btn-login-primary:focus-visible {
  background-color: var(--app-primary-dark);
  border-color: var(--app-primary-dark);
  color: #fff;
}

.auth-clinic-heading {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--app-heading);
  line-height: 1.35;
}

@media (max-width: 991.98px) {
  .login-brand-left,
  .login-brand-right {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .login-brand-left {
    border-right: 0;
    border-bottom: 1px solid #e9ecef;
    min-height: 200px;
    padding: 1.25rem;
  }
}

/* Compatibilidad: formularios Identity antiguos con clases antiguas */
.login-card-wrap {
  max-width: 100%;
}

.login-form-card {
  padding: 1.5rem 1.5rem 1.25rem;
  border-radius: var(--app-radius);
}

.login-logo-color {
  max-width: min(320px, 88vw);
  height: auto;
  object-fit: contain;
}

/* Listado pacientes — expediente destacado (estilo consultorio) */
.expediente-codigo {
  color: #c23b5a;
  font-weight: 600;
  font-size: 0.95rem;
}

.app-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 33, 33, 0.42);
  backdrop-filter: blur(1px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 1080;
}

.app-loading-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.app-loading-card {
  min-width: 250px;
  max-width: 90vw;
  padding: 1rem 1.15rem;
  border-radius: 0.75rem;
  color: #1f2d2d;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 600;
}

.app-loading-spinner {
  width: 1.15rem;
  height: 1.15rem;
  border: 3px solid rgba(42, 111, 107, 0.2);
  border-top-color: var(--app-primary);
  border-radius: 50%;
  animation: app-spin 0.9s linear infinite;
}

.app-loading-active {
  cursor: wait;
}

@keyframes app-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Select2 — agenda nueva cita (paciente tipo búsqueda) */
.form-group .select2-container {
  width: 100% !important;
}
