html {
  font-size: 14px;
}

@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;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background: #f4f6f9;
  color: #182231;
}

.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;
}

.app-navbar {
  min-height: 66px;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: #17324d;
  font-weight: 700;
}

.app-brand small {
  display: block;
  color: #738196;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.brand-mark {
  align-items: center;
  background: #176b87;
  border-radius: 0.65rem;
  color: white;
  display: inline-flex;
  height: 2.25rem;
  justify-content: center;
  width: 2.25rem;
}

.pilot-workspace {
  display: grid;
  grid-template-columns: 172px 210px minmax(0, 1fr);
  min-height: calc(100vh - 127px);
}

.workspace-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1rem 0.65rem;
}

.applications-column {
  background: #17324d;
  color: white;
}

.modules-column {
  background: white;
  border-right: 1px solid #dfe5ec;
}

.column-heading {
  padding: 0.15rem 0.4rem 0.85rem;
}

.column-eyebrow,
.content-kicker,
.pilot-label {
  display: block;
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.applications-column .column-eyebrow {
  color: #8fbed0;
}

.column-heading h1,
.column-heading h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0.2rem 0 0;
}

.column-heading p {
  color: #7a8797;
  font-size: 0.7rem;
  margin: 0.2rem 0 0;
}

.applications-column nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.application-option,
.module-option {
  align-items: center;
  border: 0;
  display: grid;
  text-align: left;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
  width: 100%;
}

.application-option {
  background: transparent;
  border-radius: 0.45rem;
  color: #dce8ee;
  gap: 0.5rem;
  grid-template-columns: auto 1fr auto;
  min-height: 2.45rem;
  padding: 0.38rem 0.48rem;
  text-decoration: none;
}

.application-option:hover,
.application-option:focus-visible,
.application-option.is-selected {
  background: #244b67;
  color: white;
}

.application-option:active {
  transform: translateY(1px);
}

.application-monogram {
  align-items: center;
  background: #e9a23b;
  border-radius: 0.38rem;
  color: #17324d;
  display: inline-flex;
  font-weight: 800;
  font-size: 0.72rem;
  height: 1.65rem;
  justify-content: center;
  width: 1.65rem;
}

.application-monogram-almacen {
  background: #8ec6a7;
}

.application-option strong,
.module-option strong {
  display: block;
  font-size: 0.82rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-chevron {
  font-size: 1.15rem;
  line-height: 1;
}

.column-footer {
  align-items: center;
  color: #a9c2cf;
  display: flex;
  font-size: 0.67rem;
  gap: 0.45rem;
  margin-top: auto;
  padding: 0.65rem 0.4rem 0;
}

.status-dot {
  background: #63d297;
  border-radius: 50%;
  height: 0.5rem;
  width: 0.5rem;
}

.module-list {
  display: grid;
  gap: 0.18rem;
}

.module-option {
  background: transparent;
  border-radius: 0.45rem;
  color: #415064;
  gap: 0.5rem;
  grid-template-columns: auto 1fr;
  min-height: 2.45rem;
  padding: 0.38rem 0.48rem;
  text-decoration: none;
}

.module-option:hover,
.module-option:focus-visible {
  background: #f1f5f7;
}

.module-option.is-selected {
  background: #e9f4f7;
  color: #155f78;
}

.module-icon {
  align-items: center;
  border: 1px solid #cbd5df;
  border-radius: 0.35rem;
  display: inline-flex;
  font-size: 0.58rem;
  font-weight: 800;
  height: 1.65rem;
  justify-content: center;
  width: 1.65rem;
}

.module-option.is-selected .module-icon {
  background: #176b87;
  border-color: #176b87;
  color: white;
}

.workspace-content {
  min-width: 0;
  padding: 2.25rem clamp(1.5rem, 4vw, 4rem);
}

.module-view {
  margin: 0 auto;
  max-width: 980px;
}

.module-view:not(.is-visible) {
  display: none;
}

.content-toolbar {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.content-kicker {
  color: #6f7d90;
}

.content-toolbar h2 {
  color: #17324d;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 700;
  margin: 0.35rem 0 0;
}

.environment-badge {
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.45rem 0.75rem;
}

.environment-production {
  background: #daf3e5;
  color: #17643c;
}

.environment-staging {
  background: #fff0c7;
  color: #795409;
}

.environment-development {
  background: #dceef8;
  color: #155f78;
}

.welcome-card,
.empty-state-card,
.summary-card {
  background: white;
  border: 1px solid #e1e6ec;
  box-shadow: 0 12px 32px rgb(23 50 77 / 7%);
}

.welcome-card {
  align-items: center;
  border-radius: 1.15rem;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: auto 1fr;
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.welcome-mark {
  align-items: center;
  background: #17324d;
  border-radius: 1rem;
  color: #f2b65b;
  display: inline-flex;
  font-size: 2.2rem;
  font-weight: 800;
  height: 5rem;
  justify-content: center;
  width: 5rem;
}

.pilot-label {
  color: #176b87;
}

.welcome-card h3 {
  color: #17324d;
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0.45rem 0 0.6rem;
}

.welcome-card p,
.summary-card p,
.empty-state-card p {
  color: #69778a;
  line-height: 1.65;
  margin-bottom: 0;
}

.summary-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.summary-card {
  border-radius: 1rem;
  padding: 1.4rem;
}

.summary-card h3 {
  color: #17324d;
  font-size: 1rem;
  font-weight: 700;
  margin: 0.55rem 0 0.4rem;
}

.summary-number {
  color: #e29a31;
  font-size: 0.76rem;
  font-weight: 800;
}

.empty-state-card {
  border-radius: 1.15rem;
  padding: clamp(2rem, 6vw, 4rem);
  text-align: center;
}

.empty-state-icon {
  align-items: center;
  background: #daf3e5;
  border-radius: 50%;
  color: #17643c;
  display: inline-flex;
  font-size: 1.5rem;
  height: 4rem;
  justify-content: center;
  width: 4rem;
}

.empty-state-card h3 {
  color: #17324d;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 1.25rem 0 0.55rem;
}

.detail-reference-page {
  margin: 0;
  max-width: none;
}

.detail-reference-toolbar {
  margin-bottom: 1.25rem;
}

.detail-reference-toolbar p {
  color: #69778a;
  margin: 0.35rem 0 0;
}

.detail-reference-search,
.detail-reference-panel,
.detail-reference-message {
  background: white;
  border: 1px solid #dfe5ec;
  border-radius: 0.8rem;
}

.detail-reference-search {
  margin-bottom: 1rem;
  padding: 1rem;
}

.detail-reference-search label {
  color: #35465a;
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.detail-reference-search-row {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.detail-reference-search-row input {
  border: 1px solid #b9c5d2;
  border-radius: 0.45rem;
  min-width: 0;
  padding: 0.62rem 0.72rem;
}

.detail-reference-search-row button {
  background: #176b87;
  border: 0;
  border-radius: 0.45rem;
  color: white;
  font-weight: 700;
  padding: 0.62rem 1rem;
}

.detail-reference-search-row button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.detail-reference-loading {
  color: #526176;
  display: block;
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

.detail-reference-loading[hidden] {
  display: none;
}

.detail-reference-search-row input:focus,
.detail-reference-search-row button:focus-visible,
.detail-reference-result:focus-visible {
  outline: 3px solid rgb(23 107 135 / 28%);
  outline-offset: 2px;
}

.detail-reference-message {
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
}

.detail-reference-message-info {
  border-color: #b9d8e4;
  color: #155f78;
}

.detail-reference-message-error {
  background: #fff4f2;
  border-color: #efc4bc;
  color: #872f24;
}

.detail-reference-empty {
  padding: 2.5rem 1.5rem;
}

.detail-reference-panel {
  box-shadow: 0 8px 24px rgb(23 50 77 / 5%);
  margin-bottom: 1rem;
  padding: 1rem;
}

.detail-reference-panel-heading {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.detail-reference-panel-heading h3 {
  color: #17324d;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.detail-reference-panel-heading span {
  color: #6f7d90;
  font-size: 0.72rem;
}

.read-only-badge {
  background: #e9f4f7;
  border-radius: 999px;
  color: #155f78 !important;
  font-weight: 700;
  padding: 0.38rem 0.65rem;
}

.detail-reference-results {
  display: grid;
  gap: 0.35rem;
}

.detail-reference-result {
  border: 1px solid #e1e6ec;
  border-radius: 0.5rem;
  color: #26384c;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.65rem 0.75rem;
  text-decoration: none;
}

.detail-reference-result:hover {
  background: #f2f7f9;
  border-color: #b9d8e4;
}

.detail-reference-result span,
.detail-reference-muted {
  color: #718094;
  font-size: 0.76rem;
}

.detail-reference-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
}

.detail-reference-grid div {
  background: #f7f9fb;
  border-radius: 0.5rem;
  padding: 0.65rem;
}

.detail-reference-grid dt {
  color: #718094;
  font-size: 0.68rem;
  font-weight: 700;
  margin-bottom: 0.18rem;
  text-transform: uppercase;
}

.detail-reference-grid dd {
  color: #213247;
  font-weight: 650;
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-reference-note {
  border-top: 1px solid #e1e6ec;
  margin-top: 1rem;
  padding-top: 0.85rem;
}

.detail-reference-note p {
  color: #526176;
  margin: 0.25rem 0 0;
}

.processing-order-counters {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.detail-reference-note select,
.detail-reference-note textarea {
  display: block;
  margin: 0.3rem 0 0.85rem;
  width: 100%;
}

.detail-reference-note textarea {
  min-height: 6.5rem;
  resize: vertical;
}

.detail-reference-label-actions {
  align-items: end;
  border-top: 1px solid #dce4ec;
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: .35rem;
  padding-top: 1rem;
}

.detail-reference-print-action {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.detail-reference-print-action label {
  color: #526176;
  font-size: .8rem;
  font-weight: 600;
}

.detail-reference-print-action input {
  max-width: 6rem;
}

.detail-reference-label-actions button:disabled,
.detail-reference-print-action input:disabled {
  cursor: not-allowed;
  opacity: .65;
}

.detail-reference-workspace {
  align-items: start;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 0.62fr);
}

.detail-reference-primary {
  min-width: 0;
}

.detail-reference-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.detail-reference-actions button {
  background: #edf4fa;
  border: 1px solid #bdd1e2;
  border-radius: .35rem;
  color: #36516a;
  font-size: .8rem;
  padding: .35rem .6rem;
}

.detail-reference-actions button:disabled {
  cursor: not-allowed;
  opacity: .65;
}

.detail-reference-actions-note {
  color: #718094;
  font-size: .76rem;
  margin: .4rem 0 .75rem;
}

.detail-reference-history-column {
  min-width: 0;
  position: sticky;
  top: 1rem;
}

.detail-reference-history-column .detail-reference-panel {
  max-height: calc(100vh - 8rem);
  overflow: auto;
}

.detail-reference-save-preview {
  width: min(56rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  border: 1px solid #c7d1dc;
  border-radius: 1rem;
  padding: 1.5rem;
  color: #102e50;
}

.detail-reference-save-preview::backdrop {
  background: rgb(11 28 45 / 0.5);
}

.detail-reference-save-preview pre {
  max-height: 18rem;
  overflow: auto;
  padding: 1rem;
  background: #f4f7fa;
  border-radius: .5rem;
}

.detail-reference-photo-dialog {
  width: min(62rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  border: 1px solid #c7d1dc;
  border-radius: 1rem;
  color: #102e50;
  padding: 1rem;
}

.detail-reference-photo-dialog::backdrop {
  background: rgb(11 28 45 / 0.5);
}

.detail-reference-photo-dialog-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.detail-reference-photo-dialog-heading h3 {
  margin: 0;
}

.detail-reference-photo-dialog-heading button {
  border: 1px solid #bdd1e2;
  border-radius: .35rem;
  background: white;
  color: #36516a;
  font-size: 1.5rem;
  line-height: 1;
}

.detail-reference-photo-dialog img {
  display: block;
  max-height: calc(100vh - 9rem);
  max-width: 100%;
  margin: 1rem auto 0;
  object-fit: contain;
}

.detail-reference-nutrition-dialog {
  width: min(56rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  border: 1px solid #c7d1dc;
  border-radius: 1rem;
  color: #102e50;
  overflow: auto;
  padding: 1rem;
}

.detail-reference-nutrition-dialog::backdrop {
  background: rgb(11 28 45 / 0.5);
}

.detail-reference-nutrition-dialog textarea {
  display: block;
  margin: .4rem 0 .75rem;
  resize: vertical;
  width: 100%;
}

.detail-reference-columns {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-reference-list {
  display: grid;
  gap: 0.45rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.detail-reference-list li {
  background: #f7f9fb;
  border-radius: 0.45rem;
  display: grid;
  gap: 0.25rem;
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding: 0.6rem;
}

.detail-reference-list span {
  color: #718094;
  font-size: 0.75rem;
}

.session-actions {
  align-items: center;
  display: flex;
  gap: 0.65rem;
}

.session-logout {
  margin: 0;
}

.session-logout button {
  background: transparent;
  border: 1px solid #cad3dd;
  border-radius: 0.4rem;
  color: #405268;
  font-size: 0.72rem;
  padding: 0.36rem 0.55rem;
}

.login-page {
  align-items: center;
  background: #f3f6f8;
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 7rem);
  padding: 1.5rem;
}

.login-panel {
  background: #fff;
  border: 1px solid #dfe5eb;
  border-radius: 0.75rem;
  box-shadow: 0 12px 36px rgb(23 50 77 / 9%);
  max-width: 28rem;
  padding: 1.5rem;
  width: 100%;
}

.login-panel h1 {
  color: #17324d;
  font-size: 1.45rem;
  margin: 0.35rem 0;
}

.login-panel > p {
  color: #647489;
  margin: 0 0 1.25rem;
}

.login-field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.login-field label {
  color: #34475e;
  font-size: 0.8rem;
  font-weight: 700;
}

.login-field input {
  border: 1px solid #bdc8d4;
  border-radius: 0.45rem;
  padding: 0.65rem 0.7rem;
}

.login-panel button {
  background: #176b87;
  border: 0;
  border-radius: 0.45rem;
  color: #fff;
  font-weight: 700;
  padding: 0.65rem 1rem;
}

.login-field input:focus,
.login-panel button:focus-visible,
.session-logout button:focus-visible {
  outline: 3px solid rgb(23 107 135 / 28%);
  outline-offset: 2px;
}

.login-error {
  color: #872f24;
  margin-bottom: 0.8rem;
}

@media (max-width: 920px) {
  .pilot-workspace {
    grid-template-columns: 160px 195px minmax(0, 1fr);
  }

  .workspace-content {
    padding: 1.75rem 1.25rem;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .detail-reference-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .pilot-workspace {
    grid-template-columns: minmax(140px, 0.85fr) minmax(175px, 1.15fr);
  }

  .workspace-column {
    min-height: 16rem;
    padding: 0.85rem 0.5rem;
  }

  .workspace-content {
    grid-column: 1 / -1;
  }

  .welcome-card {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .content-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-reference-columns,
  .detail-reference-grid,
  .detail-reference-workspace {
    grid-template-columns: 1fr;
  }

  .detail-reference-history-column {
    position: static;
  }

  .detail-reference-history-column .detail-reference-panel {
    max-height: none;
  }

  .detail-reference-search-row {
    grid-template-columns: 1fr;
  }

  .detail-reference-list li {
    grid-template-columns: 1fr;
  }

  .detail-reference-label-actions,
  .detail-reference-print-action {
    align-items: stretch;
    flex-direction: column;
  }
}
