:root {
  --app-bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #d9e0ea;
  --border-strong: #c8d2df;
  --text: #172033;
  --muted: #667085;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #15803d;
  --success-bg: #eaf7ef;
  --warning: #b45309;
  --warning-bg: #fff4df;
  --danger: #b42318;
  --danger-bg: #fdeceb;
  --info: #0369a1;
  --info-bg: #e8f4fc;
  --neutral-bg: #eef2f6;
}

body {
  background: var(--app-bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.app-navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.navbar-brand {
  color: var(--text);
  letter-spacing: 0;
}

.content-shell {
  max-width: 1240px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-header-centered {
  display: block;
  margin: 0 auto 1.5rem;
  max-width: 760px;
  text-align: center;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: 0;
  margin: 0;
}

.page-subtitle {
  color: var(--muted);
  margin-top: .25rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.dashboard-card {
  padding: 1.5rem;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .06);
}

.dashboard-actions {
  display: flex;
  justify-content: center;
  margin: 0 0 1.25rem;
}

.modal-backdrop.show {
  backdrop-filter: blur(3px);
  background: rgba(230, 235, 244, .74);
  opacity: 1;
}

.app-modal {
  border: 0;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(16, 24, 40, .18);
}

.app-modal .modal-header {
  border-bottom: 1px solid var(--border);
  padding: 1.35rem 1.6rem 1.15rem;
}

.app-modal .modal-body {
  padding: 1.5rem 1.6rem 1.6rem;
}

.modal-actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  padding-top: .25rem;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-header-centered {
  display: block;
  text-align: center;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 650;
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.critical-eyebrow {
  align-items: center;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 999px;
  color: #991b1b;
  display: inline-flex;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  padding: .35rem .6rem;
  text-transform: uppercase;
}

.safe-note {
  background: var(--info-bg);
  border: 1px solid #b8dff4;
  border-radius: 8px;
  color: #075985;
  padding: .72rem .85rem;
}

.danger-note {
  background: var(--danger-bg);
  border: 1px solid #f4b8b2;
  border-radius: 8px;
  color: var(--danger);
  padding: .9rem 1rem;
}

.requirements-list {
  color: var(--muted);
  margin: 0;
  padding-left: 1.1rem;
}

.requirements-list li + li {
  margin-top: .25rem;
}

.btn {
  border-radius: 7px;
  font-weight: 600;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

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

.job-detail-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: space-between;
  min-width: min(100%, 620px);
}

.job-detail-actions-single,
.job-detail-actions-result {
  justify-content: flex-end;
  min-width: auto;
}

.job-detail-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
}

.job-detail-link {
  align-items: center;
  display: inline-flex;
  gap: .35rem;
  min-height: 38px;
  padding-left: 0;
  padding-right: .5rem;
}

.job-detail-btn {
  align-items: center;
  display: inline-flex;
  gap: .4rem;
  justify-content: center;
  min-height: 38px;
  min-width: 164px;
}

.confirm-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: space-between;
}

.job-state-highlight {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: inline-flex;
  gap: .55rem;
  margin-top: .75rem;
  padding: .45rem .55rem;
}

.job-state-label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
}

.action-icon-btn {
  align-items: center;
  display: inline-flex;
  height: 32px;
  justify-content: center;
  padding: 0;
  width: 32px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 92px;
  padding: 1rem;
}

.metric-label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 650;
}

.metric-value {
  color: var(--text);
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: .2rem;
}

.metric-success .metric-value {
  color: var(--success);
}

.metric-warning .metric-value {
  color: var(--warning);
}

.metric-danger .metric-value {
  color: var(--danger);
}

.metric-info .metric-value {
  color: var(--info);
}

.table-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.table-wrap {
  max-height: 560px;
  overflow: auto;
}

.table {
  font-size: .82rem;
}

.table thead th {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border-strong);
  color: #344054;
  font-size: .75rem;
  font-weight: 700;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 1;
}

.table td,
.table th {
  vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-bg-type: #fbfdff;
}

.table-striped > tbody > tr:nth-of-type(even) > * {
  --bs-table-bg-type: #f6f9fc;
}

.jobs-table-centered td,
.jobs-table-centered th {
  text-align: center;
}

.history-file-chip {
  align-items: center;
  background: #eef4ff;
  border: 1px solid #c7d7fe;
  border-radius: 999px;
  color: #174ea6;
  display: inline-flex;
  gap: .35rem;
  justify-content: center;
  max-width: 220px;
  min-width: 0;
  padding: .22rem .55rem;
  vertical-align: middle;
}

.history-file-chip .bi {
  flex: 0 0 auto;
  font-size: .9rem;
}

.history-file-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.status-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
  padding: .35rem .55rem;
  white-space: nowrap;
}

.job-status-badge {
  align-items: center;
  display: inline-flex;
  font-size: .72rem;
  font-weight: 700;
  justify-content: center;
  line-height: 1;
  min-height: 24px;
  min-width: 78px;
  padding: .38rem .65rem;
  white-space: nowrap;
}

.job-result-summary {
  display: flex;
  flex-wrap: wrap;
  font-size: .8rem;
  gap: .4rem;
  justify-content: center;
  line-height: 1.35;
  margin: 0 auto;
  min-height: 24px;
}

.result-metric {
  align-items: center;
  display: inline-flex;
  font-weight: 750;
  gap: .24rem;
  white-space: nowrap;
}

.result-icon {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: .68rem;
  height: 18px;
  justify-content: center;
  line-height: 1;
  width: 18px;
}

.result-metric-success {
  color: var(--success);
}

.result-metric-success .result-icon {
  background: var(--success-bg);
}

.result-metric-neutral {
  color: #475467;
}

.result-metric-neutral .result-icon {
  background: var(--neutral-bg);
}

.result-metric-warning {
  color: var(--warning);
}

.result-metric-warning .result-icon {
  background: var(--warning-bg);
}

.result-metric-danger {
  color: var(--danger);
}

.result-metric-danger .result-icon {
  background: var(--danger-bg);
}

.result-empty {
  color: #98a2b3;
}

.history-pagination {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.history-pagination .pagination {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  gap: .25rem;
  padding: .35rem;
}

.history-pagination .page-item:first-child .page-link,
.history-pagination .page-item:last-child .page-link,
.history-pagination .page-link {
  border-radius: 999px;
}

.history-pagination .page-link {
  align-items: center;
  background: transparent;
  border: 0;
  color: #475467;
  display: inline-flex;
  font-size: .82rem;
  font-weight: 700;
  gap: .25rem;
  justify-content: center;
  min-height: 34px;
  min-width: 34px;
  padding: .38rem .7rem;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.history-pagination .page-link:hover {
  background: #eef4ff;
  color: var(--primary);
}

.history-pagination .page-link:focus {
  box-shadow: 0 0 0 .18rem rgba(37, 99, 235, .18);
}

.history-pagination .page-item.active .page-link {
  background: var(--primary);
  box-shadow: 0 6px 14px rgba(37, 99, 235, .22);
  color: #fff;
}

.history-pagination .page-item.disabled .page-link {
  background: transparent;
  color: #98a2b3;
  opacity: .75;
}

.status-OK_ACTUALIZADO,
.status-success {
  background: var(--success-bg);
  color: var(--success);
}

.status-OK_SIN_CAMBIOS,
.status-DRY_RUN_SIN_CAMBIOS,
.status-OMITIDO,
.status-neutral {
  background: var(--neutral-bg);
  color: #475467;
}

.status-DRY_RUN_ACTUALIZARIA,
.status-info {
  background: var(--info-bg);
  color: var(--info);
}

.status-NO_ENCONTRADO,
.status-NOMBRE_DIFERENTE,
.status-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-ERROR_API,
.status-ERROR_429,
.status-ERROR_CSV,
.status-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.workflow-steps {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.25rem;
}

.workflow-timeline {
  align-items: flex-start;
  display: grid;
  gap: 0;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin: 0 auto 2rem;
  max-width: 760px;
  overflow-x: auto;
  padding: .25rem .25rem .6rem;
}

.workflow-timeline-modal {
  margin-bottom: 1.55rem;
  max-width: 680px;
}

.timeline-step {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: .45rem;
  min-width: 120px;
  position: relative;
  text-align: center;
}

.timeline-step::before,
.timeline-step::after {
  background: var(--border-strong);
  content: "";
  height: 2px;
  position: absolute;
  top: 18px;
  width: 50%;
  z-index: 0;
}

.timeline-step::before {
  left: 0;
}

.timeline-step::after {
  right: 0;
}

.timeline-step:first-child::before,
.timeline-step:last-child::after {
  display: none;
}

.timeline-marker {
  align-items: center;
  background: var(--neutral-bg);
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  color: var(--muted);
  display: inline-flex;
  font-size: .8rem;
  font-weight: 750;
  height: 38px;
  justify-content: center;
  position: relative;
  width: 38px;
  z-index: 1;
}

.timeline-label {
  font-size: .82rem;
  font-weight: 650;
  white-space: nowrap;
}

.timeline-step-active,
.timeline-step-active .timeline-marker {
  color: #1e40af;
}

.timeline-step-active .timeline-marker {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.timeline-step-active .timeline-label {
  color: #1e40af;
}

.workflow-step {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: .78rem;
  font-weight: 650;
  gap: .4rem;
  padding: .38rem .7rem;
}

.workflow-step-active {
  background: var(--info-bg);
  border-color: #b8dff4;
  color: var(--info);
}

.upload-dropzone {
  align-items: center;
  background: #fbfdff;
  border: 1.5px dashed var(--border-strong);
  border-radius: 10px;
  display: flex;
  gap: .95rem;
  min-height: 108px;
  padding: 1rem 1.1rem;
  position: relative;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.upload-dropzone:hover,
.upload-dropzone.is-dragging {
  background: #f5f9ff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.upload-dropzone input[type="file"] {
  height: 1px;
  left: 1rem;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  top: 1rem;
  width: 1px;
  z-index: -1;
}

.upload-dropzone:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.upload-icon {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--primary);
  display: inline-flex;
  flex: 0 0 44px;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.upload-icon svg {
  fill: none;
  height: 24px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 24px;
}

.upload-copy {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.upload-button {
  background: var(--surface);
  margin: 0;
}

.upload-hint {
  color: var(--muted);
  font-size: .88rem;
}

.csv-requirements {
  color: var(--muted);
  margin-top: -.2rem;
}

.simulation-form {
  display: grid;
  gap: 1rem;
}

.workflow-step-danger {
  background: var(--danger-bg);
  border-color: #f4b8b2;
  color: var(--danger);
}

.simulation-form {
  display: grid;
  gap: 1rem;
}

.form-field {
  display: grid;
  gap: .45rem;
}

.form-label {
  color: #344054;
  font-weight: 650;
  margin-bottom: 0;
}

.login-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 110px);
  padding: 1.5rem 0;
}

.login-card {
  max-width: 430px;
  padding: 1.75rem;
  width: min(100%, 430px);
}

.login-header {
  text-align: center;
}

.login-brand-mark {
  align-items: center;
  background: var(--info-bg);
  border: 1px solid #b8dff4;
  border-radius: 12px;
  color: var(--primary);
  display: inline-flex;
  font-size: 1.35rem;
  height: 48px;
  justify-content: center;
  margin-bottom: .85rem;
  width: 48px;
}

.login-subtitle {
  color: var(--muted);
  margin: .4rem 0 0;
}

.login-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.4rem;
}

.login-alert {
  font-size: .88rem;
  margin: 0;
}

.password-field {
  display: flex;
}

.password-field .form-control {
  border-bottom-right-radius: 0;
  border-right: 0;
  border-top-right-radius: 0;
}

.password-toggle {
  align-items: center;
  border-bottom-left-radius: 0;
  border-top-left-radius: 0;
  display: inline-flex;
  justify-content: center;
  width: 44px;
}

.login-submit {
  margin-top: .15rem;
}

.login-footnote {
  color: var(--muted);
  font-size: .78rem;
  margin-top: 1.1rem;
  text-align: center;
}

.form-control,
.form-select {
  border-color: var(--border-strong);
  border-radius: 7px;
}

.form-control[type="file"]::file-selector-button {
  background-color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-weight: 650;
  margin-right: .75rem;
  padding: .45rem .75rem;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.form-control[type="file"]:hover::file-selector-button,
.form-control[type="file"]:hover:not(:disabled):not([readonly])::file-selector-button,
.form-control[type="file"]::file-selector-button:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12);
}

.swal2-popup {
  border-radius: 10px;
  color: var(--text);
}

.swal2-title {
  font-size: 1.25rem;
  letter-spacing: 0;
}

.swal2-html-container,
.swal2-content {
  color: var(--muted);
  font-size: .95rem;
}

.swal2-confirm.swal2-styled {
  background: var(--primary);
  border-radius: 7px;
  font-weight: 650;
}

.swal2-cancel.swal2-styled {
  border-radius: 7px;
  font-weight: 650;
}

.swal2-icon.swal2-error {
  border-color: #f0a59d;
  color: var(--danger);
}

@media (max-width: 575.98px) {
  .page-header-centered {
    text-align: left;
  }

  .workflow-timeline {
    justify-content: flex-start;
    margin-left: -.25rem;
    margin-right: -.25rem;
  }

  .dashboard-card {
    padding: 1.1rem;
  }
}
