html {
  font-size: 14px;
  min-height: 100%;
}

:root {
  --sidebar-width: 225px;
  --topbar-height: 56px;
  --sidebar-bg: #1f2d3d;
  --sidebar-text: rgba(255, 255, 255, .9);
  --sidebar-muted: rgba(255, 255, 255, .62);
  --sidebar-hover: rgba(255, 255, 255, .075);
  --sidebar-active: #0d6efd;
  --erp-font-page-title: 1.2rem;
  --erp-font-heading: .9375rem;
  --erp-font-body: .875rem;
  --erp-font-ui: .8125rem;
  --erp-font-meta: .75rem;
  --erp-font-emphasis: 1rem;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

body {
  min-height: 100vh;
  margin: 0;
  color: #1f2937;
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.12), transparent 30%),
    linear-gradient(180deg, #f4f7fb 0%, #eef3f9 100%);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.skip-link {
  position: fixed;
  top: .5rem;
  left: .5rem;
  z-index: 1040;
}

.erp-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgb(255 255 255 / 70%);
}

.descripcion-resumen {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    overflow: hidden;
    line-height: 1.15rem;
    max-height: 5.75rem;
    word-break: break-word;
    cursor: help;
}

.audit-entry-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.audit-change {
  background-color: rgba(255, 255, 255, 0.7);
}

.audit-value {
  border-radius: 0.75rem;
  padding: 1rem;
  border: 1px solid transparent;
}

.audit-value-old {
  background-color: rgba(220, 53, 69, 0.08);
  border-color: rgba(220, 53, 69, 0.18);
}

.audit-value-new {
  background-color: rgba(25, 135, 84, 0.08);
  border-color: rgba(25, 135, 84, 0.18);
}

.audit-value-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.audit-arrow {
  font-size: 1.75rem;
  color: #64748b;
  font-weight: 700;
}

.audit-json {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.875rem;
  background-color: rgba(15, 23, 42, 0.04);
  border-radius: 0.5rem;
  padding: 0.75rem;
}

.audit-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.audit-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.audit-check-icon {
  line-height: 1.2;
}

.erp-dialog {
  border-radius: 1rem;
  box-shadow: 0 1.25rem 2.5rem rgba(15, 23, 42, .2);
}

.erp-dialog .swal2-title {
  font-size: var(--erp-font-heading);
  line-height: 1.3;
}

.erp-dialog .swal2-html-container {
  color: #52616b;
  font-size: var(--erp-font-body);
  line-height: 1.45;
}

.erp-dialog .swal2-actions {
  gap: .5rem;
}

.erp-dialog .swal2-styled {
  padding: .45rem .8rem;
  font-size: var(--erp-font-ui);
}

.erp-toast {
  border-radius: .75rem;
  box-shadow: 0 .75rem 1.75rem rgba(15, 23, 42, .18);
}

.erp-toast .swal2-title {
  font-size: var(--erp-font-ui);
  line-height: 1.35;
}

/* Ajustes compactos del menú: se mantienen aquí para que también se apliquen
   cuando el sitio está ejecutándose sin recompilación de vistas Razor. */
#appSidebar {
  overflow-x: hidden !important;
}

#appSidebar .accordion-button,
#appSidebar .sidebar-menu-link {
  min-height: 40px !important;
  padding: .55rem .7rem !important;
  font-size: .875rem !important;
}

#appSidebar .nav-link {
  font-size: .875rem !important;
}

#appSidebar .sidebar-menu-icon {
  width: 1.25rem !important;
  margin-right: .5rem !important;
  font-size: 1rem !important;
}

#appSidebar .sidebar-menu-label,
#appSidebar .sidebar-submenu-link {
  overflow-wrap: anywhere;
}

#appSidebar .sidebar-submenu-link {
  margin: .05rem .35rem .05rem .9rem !important;
  padding: .45rem .65rem !important;
  font-size: .8125rem !important;
  line-height: 1.25 !important;
}

#appSidebar .sidebar-section {
  margin: .6rem .8rem .25rem !important;
  padding: .2rem .4rem !important;
  font-size: .65rem !important;
}

#appSidebar .accordion-button::after {
  width: .75rem !important;
  height: .75rem !important;
  background-size: .75rem !important;
}

#appSidebar .is-current-section > .accordion-header .accordion-button,
#appSidebar .sidebar-menu-link.active {
  color: #fff !important;
  background-color: rgba(255,255,255,.1) !important;
  box-shadow: inset 2px 0 0 #91afc7 !important;
}

#appSidebar .sidebar-submenu-link.active {
  color: #fff !important;
  font-weight: 600 !important;
  background-color: rgba(255,255,255,.08) !important;
  box-shadow: inset 2px 0 0 #91afc7 !important;
}

#appSidebar .sidebar-section-group {
  margin: .45rem 0 .15rem;
}

#appSidebar .sidebar-section-toggle {
  display: flex;
  align-items: center;
  width: calc(100% - 1.6rem);
  margin: 0 .8rem;
  padding: .25rem .4rem;
  color: var(--sidebar-muted);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
  background: transparent;
  border: 0;
  border-left: 2px solid rgba(255,255,255,.3);
}

#appSidebar .sidebar-section-toggle::after {
  width: .45rem;
  height: .45rem;
  margin-left: auto;
  content: "";
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-.15rem);
  transition: transform .18s ease;
}

#appSidebar .sidebar-section-toggle:not(.collapsed)::after {
  transform: rotate(-135deg) translate(-.15rem, -.15rem);
}

#appSidebar .sidebar-section-toggle:hover {
  color: #fff;
}

#appSidebar .sidebar-section-toggle:focus-visible {
  outline: 2px solid #86d8ff;
  outline-offset: 2px;
}

.page-header-card {
  border-radius: .7rem !important;
  box-shadow: 0 .08rem .18rem rgba(0,0,0,.04) !important;
  margin-bottom: .65rem !important;
}

.page-header-card .card-body {
  padding: .6rem .9rem !important;
}

.page-header-card h1 {
  margin: 0 !important;
  font-size: var(--erp-font-page-title) !important;
  line-height: 1.25 !important;
}

.app-topbar,
.navbar.bg-dark {
  background-color: var(--sidebar-bg) !important;
}

.app-user-name,
.app-profile-toggle {
  color: var(--sidebar-text);
  font-size: var(--erp-font-ui);
}

.app-brand-context {
  display: flex;
  align-items: center;
  min-width: 0;
}

.app-brand-context .navbar-brand {
  flex-shrink: 0;
}

.app-brand-customer {
  max-width: min(32vw, 28rem);
  margin-left: .75rem;
  padding-left: .75rem;
  overflow: hidden;
  color: var(--sidebar-muted);
  border-left: 1px solid rgba(255, 255, 255, .25);
  font-size: var(--erp-font-ui);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-profile-toggle {
  max-width: min(24vw, 18rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.app-profile-toggle {
  border: 0;
  padding: .35rem .5rem;
  background: transparent;
}

.app-profile-toggle:hover,
.app-profile-toggle:focus-visible,
.app-profile-toggle.show {
  color: #fff;
  background-color: var(--sidebar-hover);
}

.app-profile-toggle:focus-visible {
  outline: 2px solid #86d8ff;
  outline-offset: 2px;
  box-shadow: none;
}

.app-topbar .dropdown-menu {
  min-width: 10rem;
  font-size: var(--erp-font-ui);
}

.app-topbar .dropdown-item {
  padding: .45rem .75rem;
}

.app-topbar .dropdown-item:focus-visible {
  outline: 2px solid #86d8ff;
  outline-offset: -2px;
}

.app-copilot-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: .15rem .5rem .15rem .3rem;
  color: #1f2d3d;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: .35rem;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.app-copilot-link img {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  object-fit: contain;
}

.app-copilot-label {
  font-size: var(--erp-font-ui);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.app-copilot-link:hover {
  color: #152231;
  background-color: #f1f5f9;
  border-color: #fff;
  box-shadow: 0 0 .35rem rgba(255, 255, 255, .2);
}

.app-copilot-link:focus-visible {
  outline: 2px solid #86d8ff;
  outline-offset: 2px;
}

.app-topbar-nav-link {
  display: inline-flex;
  align-items: center;
  padding: .35rem .45rem;
  color: var(--sidebar-text);
  font-size: var(--erp-font-ui);
  text-decoration: none;
  white-space: nowrap;
}

.app-topbar-nav-link:hover,
.app-topbar-nav-link:focus-visible,
.app-topbar-nav-link.show {
  color: #fff;
  background-color: var(--sidebar-hover);
}

.app-topbar-nav-link:focus-visible {
  outline: 2px solid #86d8ff;
  outline-offset: 2px;
}

.app-topbar .dropdown > .app-topbar-nav-link {
  border: 0;
  background: transparent;
}

@media (max-width: 575.98px) {
  .app-brand-customer {
    max-width: 35vw;
    margin-left: .5rem;
    padding-left: .5rem;
  }

  .app-profile-toggle {
    max-width: 7rem;
  }

  .app-copilot-link {
    width: 2rem;
    padding: .15rem;
  }

  .app-copilot-label {
    display: none;
  }
}

/* La pantalla CAE usa la misma escala mientras la aplicación se ejecuta sin
   recompilar sus vistas Razor. */
.cae-shell {
  font-size: var(--erp-font-body) !important;
}

.cae-toolbar {
  justify-content: flex-end !important;
}

.cae-metric strong,
.cae-metric-comments strong {
  font-size: var(--erp-font-emphasis) !important;
}

.cae-metric span,
.cae-field label,
.cae-ai-result pre {
  font-size: var(--erp-font-meta) !important;
}

.cae-view,
.cae-ia-toggle,
.cae-ia-option {
  font-size: var(--erp-font-ui) !important;
}

.cae-detail-head h2,
.cae-section h3,
.cae-actions > h2 {
  font-size: var(--erp-font-heading) !important;
}

.cae-section-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0;
  color: #18212f;
  text-align: left;
  background: transparent;
  border: 0;
}

.cae-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .55rem;
}

.cae-section-header h3 {
  margin: 0;
}

.cae-state-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .3rem;
}

.cae-state-option {
  min-height: 30px;
  padding: .3rem .4rem;
  color: #526174;
  font-size: var(--erp-font-ui);
  line-height: 1.2;
  background: #fff;
  border: 1px solid #cbd4df;
  border-radius: .35rem;
}

.cae-state-option:hover {
  color: #18212f;
  background: #f1f5f9;
}

.cae-state-option.is-selected {
  color: #102a43;
  font-weight: 700;
  background: #d9e8f5;
  border-color: #668caf;
  box-shadow: inset 3px 0 0 #3f6f99;
}

.cae-state-option:focus-visible {
  outline: 2px solid #258cfb;
  outline-offset: 2px;
}

#validityDate.is-empty-date {
  color: transparent;
}

#validityDate.is-empty-date::-webkit-datetime-edit {
  color: transparent;
}

.cae-section-toggle-title {
  font-size: var(--erp-font-heading);
  font-weight: 600;
}

.cae-section-toggle::after {
  width: .45rem;
  height: .45rem;
  margin-left: auto;
  content: "";
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-.15rem);
  transition: transform .18s ease;
}

.cae-section-toggle[aria-expanded="true"]::after {
  transform: rotate(-135deg) translate(-.15rem,-.15rem);
}

.cae-section-toggle:focus-visible {
  outline: 2px solid #258cfb;
  outline-offset: 3px;
  border-radius: .2rem;
}

.cae-section-content {
  margin-top: .55rem;
}


.cae-detail-summary .cae-detail-grid > .cae-key-field {
  padding: .55rem .65rem;
  border: 1px solid #d6e2ef;
  border-left: 3px solid #7096b8;
  border-radius: .5rem;
  background: #f5f8fc;
}

.cae-detail-summary .cae-detail-grid > .cae-key-field > div {
  color: #18212f;
  font-size: var(--erp-font-emphasis);
  font-weight: 650;
  line-height: 1.25;
}

.cae-key-value {
  display: grid;
  gap: .3rem;
}

.cae-key-identifier {
  color: #18212f;
  font-size: inherit;
  font-weight: 650;
  line-height: 1.25;
}

.cae-company-only {
  grid-column: 1 / -1;
}

/* Shared Core/Legacy login entry point. */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #102a43, #243b53);
}

.login-page {
    display: grid;
    min-height: 100vh;
    padding: 1.5rem;
    place-items: center;
}

.login-card {
    width: min(100%, 27rem);
    padding: 2rem;
    background: #fff;
    border-radius: .75rem;
    box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, .2);
}

.login-card h1 {
    margin-bottom: .5rem;
    font-size: 1.5rem;
}

.login-card p {
    margin-bottom: 1.5rem;
    color: #52606d;
}

.login-card .form-label {
    display: block;
    margin-bottom: .4rem;
    color: #243b53;
    font-size: .875rem;
    font-weight: 600;
}

.login-card .form-control {
    min-height: 2.75rem;
}

.login-card .form-check {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
}

.login-card .form-check-input {
    flex: 0 0 auto;
    margin-top: .2rem;
}

.login-card .form-check-label {
    color: #52606d;
    font-size: .875rem;
    line-height: 1.35;
}

.login-card .text-danger {
    display: block;
    margin-top: .35rem;
    font-size: .8125rem;
}

.login-brand {
    margin-bottom: 1.5rem;
    color: #0b7285;
    font-size: 1.125rem;
    font-weight: 700;
}
