html {
  font-size: 16px;
  min-height: 100%;
  position: relative;
}

body {
  background: #f5f8fb;
  color: #092042;
  margin: 0;
}

.portal-container {
  margin: 0 auto;
  max-width: 72rem;
  padding: clamp(0.75rem, 3vw, 2rem);
}

.skip-link {
  background: #fff;
  color: #164d9d;
  left: 1rem;
  padding: 0.75rem 1rem;
  position: fixed;
  top: -5rem;
  z-index: 1100;
}

.skip-link:focus {
  top: 1rem;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid #ffe06b;
  outline-offset: 3px;
}

a {
  color: #0867ab;
}

.welcome {
  background: #fff;
  border: 1px solid #cfdae8;
  border-radius: 0.75rem;
  box-shadow: 0 0.25rem 1rem rgb(15 23 42 / 8%);
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.5rem);
}

.welcome h1 {
  color: #092042;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.portal-brand {
  align-items: center;
  display: flex;
  gap: 0.8rem;
  margin-bottom: 0.35rem;
}

.portal-brand .eyebrow {
  flex: 0 0 auto;
  margin: 0;
}

.portal-brand-divider {
  align-self: stretch;
  background: #b9ccdf;
  width: 1px;
}

.portal-logo {
  height: auto;
  max-height: 2.2rem;
  max-width: min(12rem, 48vw);
  width: auto;
}

.eyebrow,
.step-label {
  color: #267399;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.service-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1.5rem;
}

.service-card {
  background: #fff;
  border: 1px solid #b9ccdf;
  border-radius: 0.65rem;
  color: #092042;
  display: flex;
  flex-direction: column;
  min-height: 12rem;
  padding: 1.25rem;
  text-align: left;
}

.service-card-action {
  border: 2px solid #164d9d;
  cursor: pointer;
}

.service-card-action:hover {
  background: #f5f8fb;
  box-shadow: 0 0.35rem 1rem rgb(22 77 157 / 16%);
}

.service-card-title {
  color: #092042;
  font-size: 1.08rem;
  font-weight: 700;
}

.service-card-description {
  flex: 1;
  margin-top: 0.65rem;
}

.service-status {
  color: #60727a;
  font-size: 0.86rem;
  font-weight: 700;
  margin-top: 1rem;
}

.service-status.is-available {
  color: #164d9d;
}

.service-card.is-disabled {
  background: #f5f8fb;
  color: #60727a;
}

.workflow-step {
  margin: 0 auto;
  max-width: 48rem;
}

.workflow-step h2 {
  color: #092042;
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  font-weight: 700;
}

.notice {
  background: #eef6fc;
  border-left: 4px solid #267399;
  border-radius: 0.35rem;
  color: #092042;
  margin-top: 1.5rem;
  padding: 1rem;
}

.workflow-navigation {
  margin-bottom: 0.75rem;
}

.workflow-back {
  background: transparent;
  border: 0;
  color: #0867ab;
  cursor: pointer;
  font-weight: 600;
  padding: 0.25rem 0;
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.workflow-back:hover {
  color: #164d9d;
}

.local-test {
  border-top: 1px solid #cfdae8;
  margin-top: 2rem;
  padding-top: 1.5rem;
}

[hidden] {
  display: none !important;
}

.local-test h2 {
  color: #092042;
  font-size: 1.35rem;
}

.form-row {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.form-field {
  flex: 1 1 18rem;
}

.form-row > .btn,
.form-row > .otp-actions {
  margin-bottom: 1.7rem;
}

.form-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.form-field input {
  border: 1px solid #267399;
  border-radius: 0.25rem;
  min-height: 44px;
  padding: 0.5rem 0.65rem;
  width: 100%;
}

.form-field input[aria-invalid="true"] {
  border-color: #b42318;
  box-shadow: 0 0 0 1px #b42318;
}

.expediente-mask {
  align-items: center;
  background: #fff;
  border: 1px solid #267399;
  border-radius: 0.25rem;
  display: flex;
  min-height: 44px;
  overflow: hidden;
  width: min(100%, 22rem);
}

.expediente-mask:focus-within {
  border-color: #164d9d;
  box-shadow: 0 0 0 3px rgba(255, 224, 107, 0.75);
}

.expediente-mask[aria-invalid="true"] {
  border-color: #b42318;
  box-shadow: 0 0 0 1px #b42318;
}

.form-field .expediente-mask .expediente-segment {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-width: 0;
  outline: 0;
  padding: 0.5rem 0.65rem;
}

.form-field .expediente-mask .expediente-segment[aria-invalid="true"] {
  border: 0;
  box-shadow: none;
}

.form-field .expediente-mask .expediente-number {
  flex: 0 1 10rem;
  width: 10rem;
}

.form-field .expediente-mask .expediente-year {
  background-color: #fff;
  color: #092042;
  cursor: pointer;
  flex: 0 0 6rem;
  min-height: 42px;
  text-align: center;
  width: 6rem;
}

.form-field .expediente-mask .expediente-year:disabled {
  cursor: default;
  opacity: 1;
}

.expediente-separator,
.expediente-suffix {
  color: #092042;
  flex: 0 0 auto;
  font-weight: 700;
}

.expediente-suffix {
  padding: 0 0.75rem 0 0.5rem;
}

.otp-request-actions {
  margin-top: 0.75rem;
}

.form-help,
.validation-message {
  display: block;
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.form-help,
.resend-status {
  color: #465a64;
}

.validation-message {
  color: #9b1c1c;
  font-weight: 600;
}

.otp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.welcome .btn {
  border-radius: 0.4rem;
  font-weight: 600;
  min-height: 44px;
  padding-inline: 1.1rem;
}

.welcome .btn-primary {
  background: #164d9d;
  border-color: #164d9d;
}

.welcome .btn-primary:hover {
  background: #123f82;
  border-color: #123f82;
}

.resend-status {
  margin: 0.75rem 0 0;
}

.attachment-section form {
  margin-top: 1rem;
}

.attachment-heading-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
}

.attachment-heading-row .step-label {
  margin: 0;
}

.attachment-expediente-context {
  background: #eaf2fb;
  border-radius: 999px;
  color: #092042;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
}

.quarantine-notice {
  align-items: center;
  background: transparent;
  color: #092042;
  display: flex;
  gap: 0.65rem;
  margin-top: 1rem;
  padding: 0.75rem 0;
}

.security-mark {
  align-items: center;
  border: 1px solid #267399;
  border-radius: 50%;
  color: #164d9d;
  display: inline-flex;
  flex: 0 0 1.25rem;
  font-size: 0.75rem;
  height: 1.25rem;
  justify-content: center;
}

.attachment-file-input {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.attachment-picker {
  align-items: center;
  border: 1px dashed #aebdce;
  border-radius: 0.75rem;
  cursor: pointer;
  display: flex !important;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.4rem;
  padding: 1.1rem;
  text-align: center;
}

.attachment-picker:hover {
  background: #f5f8fb;
  border-color: #267399;
}

.attachment-picker.is-dragging {
  background: #eaf3fb;
  border-color: #0867ab;
  box-shadow: 0 0 0 3px rgba(8, 103, 171, 0.16);
}

.attachment-file-input:focus-visible + .attachment-picker {
  box-shadow: 0 0 0 3px rgba(255, 224, 107, 0.75);
  outline: 2px solid #164d9d;
  outline-offset: 2px;
}

.attachment-picker-icon {
  color: #267399;
  font-size: 1.6rem;
  line-height: 1;
}

.attachment-picker > span:not(.attachment-picker-icon):not(.attachment-picker-action) {
  color: #465a64;
  font-size: 0.88rem;
  font-weight: 400;
}

.attachment-picker-action {
  background: #164d9d;
  border-radius: 999px;
  color: #fff;
  font-weight: 600;
  padding: 0.5rem 1.1rem;
}

.attachment-file-input:disabled + .attachment-picker {
  cursor: progress;
  opacity: 0.65;
}

.attachment-formats {
  color: #465a64;
  font-size: 0.9rem;
  margin-top: 0.65rem;
}

.attachment-formats summary {
  color: #0867ab;
  cursor: pointer;
  font-weight: 600;
}

.attachment-formats ul {
  margin: 0.55rem 0 0;
  padding-left: 1.25rem;
}

.upload-progress {
  background: #f5f8fb;
  border: 1px solid #cfdae8;
  border-radius: 0.5rem;
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
}

.upload-progress[hidden] {
  display: none;
}

.upload-progress-heading {
  align-items: center;
  color: #092042;
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

#attachment-progress {
  accent-color: #164d9d;
  display: block;
  height: 0.8rem;
  width: 100%;
}

.upload-progress .form-help {
  display: block;
  margin-top: 0.35rem;
}

.processing-indicator {
  align-items: center;
  background: #f5f8fb;
  border-left: 4px solid #267399;
  border-radius: 0.35rem;
  color: #092042;
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 1rem;
}

.processing-indicator[hidden] {
  display: none;
}

.processing-spinner {
  animation: processing-spin 0.8s linear infinite;
  border: 3px solid #cfdae8;
  border-radius: 50%;
  border-top-color: #164d9d;
  flex: 0 0 auto;
  height: 1.4rem;
  width: 1.4rem;
}

@keyframes processing-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .processing-spinner {
    animation: none;
    border-color: #164d9d;
  }
}

#attachment-list-region h3 {
  border-top: 1px solid #dce4ed;
  color: #092042;
  font-size: 1.1rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
}

.attachment-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.attachment-item {
  align-items: center;
  border-bottom: 1px solid #cfdae8;
  display: flex;
  gap: 1rem;
  justify-content: flex-start;
  padding: 0.85rem 0;
}

.attachment-item div {
  flex: 1 1 auto;
  min-width: 0;
}

.attachment-file-mark {
  color: #0867ab;
  flex: 0 0 auto;
}

.attachment-remove {
  background: transparent;
  border: 0;
  color: #b42318;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 1.5rem;
  line-height: 1;
  margin-left: auto;
  min-height: 2.75rem;
  min-width: 2.75rem;
}

.attachment-remove:hover,
.attachment-remove:focus-visible {
  background: #fff1f0;
  border-radius: 50%;
}

.attachment-item strong,
.attachment-item span {
  display: block;
  overflow-wrap: anywhere;
}

.attachment-item span,
.attachment-summary {
  color: #465a64;
  font-size: 0.9rem;
}

.reception-receipt {
  background: #f5f8fb;
  border: 1px solid #267399;
  border-radius: 0.75rem;
  margin: 0 auto;
  max-width: 42rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  text-align: center;
}

.reception-receipt dl {
  display: grid;
  grid-template-columns: minmax(10rem, max-content) 1fr;
  gap: 0.35rem 1rem;
  margin: 1.5rem auto;
  max-width: 34rem;
  text-align: left;
}

.reception-receipt dd {
  margin: 0;
  font-weight: 600;
}

.expediente-summary {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.expediente-summary-block {
  background: #fff;
  border: 1px solid #cfdae8;
  border-left: 4px solid #267399;
  border-radius: 0.5rem;
  padding: 1rem;
}

.expediente-summary-block h3 {
  color: #092042;
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
}

.expediente-summary-block p,
.expediente-summary-block dl {
  margin: 0;
}

.expediente-summary-block dl > div {
  display: grid;
  gap: 0.2rem 1rem;
  grid-template-columns: minmax(10rem, 13rem) 1fr;
  padding: 0.25rem 0;
}

.expediente-summary-block dt {
  font-weight: 700;
}

.expediente-summary-block dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.preserve-lines {
  white-space: pre-line;
}

#expediente-summary-actions {
  margin-top: 1.25rem;
}

.success-mark {
  align-items: center;
  background: #164d9d;
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  font-size: 1.5rem;
  font-weight: 700;
  height: 3rem;
  justify-content: center;
  margin-bottom: 1rem;
  width: 3rem;
}

.receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.attachment-summary {
  display: flex;
  justify-content: space-between;
  margin-top: 0.85rem;
}

#attachment-capacity {
  accent-color: #164d9d;
  height: 0.55rem;
  margin-top: 0.45rem;
  width: 100%;
}

.reception-submit {
  margin-top: 0.75rem !important;
  padding-top: 1rem;
  text-align: center;
}

.reception-submit .form-help {
  margin: 0.75rem 0 0;
}

#reception-confirm {
  font-size: 1.05rem;
  min-width: 13rem;
  padding: 0.75rem 1.25rem;
  width: 100%;
}

.test-result {
  background: #f5f8fb;
  border-left: 4px solid #267399;
  border-radius: 0.35rem;
  margin-top: 1.25rem;
  overflow-wrap: anywhere;
  padding: 1rem;
}

.test-result[hidden],
.validation-message[hidden],
.resend-status[hidden] {
  display: none;
}

.test-result dt {
  font-weight: 700;
}

.development-tools {
  border-top: 1px solid #cfdae8;
  color: #465a64;
  margin-top: 2rem;
  padding-top: 1rem;
}

.development-tools > summary {
  cursor: pointer;
  font-weight: 600;
}

.development-tools .local-test {
  margin-top: 1rem;
}

@media (max-width: 575.98px) {
  .portal-brand {
    gap: 0.55rem;
  }

  .portal-logo {
    max-height: 1.9rem;
    max-width: min(10rem, 50vw);
  }

  .portal-container {
    padding: 0;
  }

  .welcome {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 1.25rem;
  }

  .service-grid {
    grid-template-columns: 1fr;
  }

  .service-card {
    min-height: 9rem;
  }

  .form-row,
  .otp-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-field,
  .welcome .btn {
    flex-basis: auto;
    width: 100%;
  }

  .form-row > .btn,
  .form-row > .otp-actions {
    margin-bottom: 0;
  }

  .expediente-summary-block dl > div {
    grid-template-columns: 1fr;
  }

  .attachment-item {
    align-items: stretch;
    flex-direction: column;
  }

  .reception-receipt dl {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .reception-receipt dt {
    margin-top: 0.5rem;
  }
}
