:root {
  --navy: #1c2b45;
  --navy-soft: #445068;
  --teal: #0e6b5c;
  --teal-dark: #0a5348;
  --teal-bg: #e6f2ef;
  --border: #dde1e8;
  --bg: #f4f5f7;
  --grey: #667085;
  --grey-light: #98a2b3;
  --red: #b3261e;
  --amber: #92660a;
  --amber-bg: #fbf3e1;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--navy);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* --- Navbar --- */

.navbar {
  background: #103e43;
  border-bottom: 1px solid #0a2f32;
  height: 64px;
  display: flex;
  align-items: center;
}

.navbar-inner {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.brand-mark { display: none; }
.brand-icon { height: 30px; width: auto; display: block; }
.brand-suffix { font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, 0.7); margin-left: 2px; }

.nav-links { display: flex; gap: 28px; height: 100%; align-items: center; }

.nav-links a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 22px 0;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover { color: #fff; }
.nav-links a.active { color: #fff; font-weight: 700; border-bottom-color: #fff; }

.nav-user { color: #fff; font-size: 14px; font-weight: 600; }

/* --- Page shell --- */

.page { max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; }

.card {
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  padding: 28px 32px;
  border: 1px solid var(--border);
}

.card.wide { max-width: 1072px; }
.card.narrow { max-width: 420px; }

h1 {
  color: var(--navy);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}

.subtitle { color: var(--grey); margin: 0 0 22px; font-size: 14px; }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }

/* --- Stat cards (resumen) --- */

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 20px 0 28px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}

.stat-card .stat-number { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat-card .stat-label { font-size: 13px; color: var(--grey); margin-top: 4px; }
.stat-card.stat-accent .stat-number { color: var(--teal); }
.stat-card.stat-warn .stat-number { color: var(--amber); }

/* --- Forms --- */

label {
  display: block;
  font-weight: 600;
  color: var(--navy-soft);
  margin: 18px 0 6px;
  font-size: 13px;
}
label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="search"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--navy);
  background: #fff;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-bg);
}

input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: #fafbfc;
  color: var(--grey);
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--navy);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

button,
input[type="submit"] {
  margin-top: 24px;
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: 6px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}

button:hover { background: var(--teal-dark); }

button.btn-secondary {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--border);
}
button.btn-secondary:hover { background: #f6f7f9; }

.row { display: flex; gap: 18px; }
.row > div { flex: 1; }

.form-section {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--teal-dark);
  margin: 28px 0 6px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.form-section:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }

/* --- Alerts --- */

.error, .warning, .ok, .hint-box {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 16px 0;
  font-size: 13.5px;
  line-height: 1.5;
  border: 1px solid;
}

.error { background: #fbeceb; border-color: #f1c3bf; color: #7a2a24; }
.warning { background: var(--amber-bg); border-color: #edd9a3; color: var(--amber); }
.ok { background: var(--teal-bg); border-color: #bfdfd8; color: var(--teal-dark); }
.hint-box { background: #eef1f5; border-color: var(--border); color: var(--navy-soft); }

/* --- Result page --- */

.field-value {
  background: #f6f7f9;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  word-break: break-all;
  color: var(--navy-soft);
  font-family: "Consolas", "SFMono-Regular", monospace;
}

a.button-link {
  display: inline-block;
  margin-top: 8px;
  background: var(--teal);
  color: #fff;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}
a.button-link:hover { background: var(--teal-dark); }
a.button-link.secondary { background: #fff; color: var(--navy); border: 1px solid var(--border); }
a.button-link.secondary:hover { background: #f6f7f9; }
a.button-link + a.button-link { margin-left: 10px; }

.detail-layout {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  align-items: start;
}

.side-block {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
}

.side-block h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--grey);
  margin: 0 0 14px;
  font-weight: 700;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  padding: 0 0 14px 16px;
  border-left: 2px solid var(--border);
  margin-left: 4px;
  position: relative;
  font-size: 13px;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline .t-time { color: var(--grey); font-size: 12px; display: block; }
.timeline .t-label { color: var(--navy); font-weight: 600; }

.steps { margin: 20px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--navy-soft); }
.steps li { margin-bottom: 7px; }

.qr-box { text-align: center; margin: 20px 0; }
.qr-box p { font-size: 12.5px; color: var(--grey); margin: 0 0 8px; }

/* --- Links / hints --- */

a.link { color: var(--teal-dark); font-size: 14px; text-decoration: none; font-weight: 600; }
a.link:hover { text-decoration: underline; }

.hint { color: var(--grey-light); font-size: 12.5px; margin: 8px 0 0; }

/* --- Filter bar --- */

.filter-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin: 4px 0 6px;
  flex-wrap: wrap;
}
.filter-bar .field { min-width: 200px; }
.filter-bar label { margin: 0 0 6px; }
.filter-bar button { margin-top: 0; }

/* --- Table --- */

.list-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13.5px; }

.list-table th {
  text-align: left;
  color: var(--grey);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}

.list-table td { padding: 12px; border-bottom: 1px solid #eef0f3; }
.list-table tbody tr:hover { background: #fafbfc; }
.list-table a { color: var(--teal-dark); text-decoration: none; font-weight: 600; }
.list-table a:hover { text-decoration: underline; }

.link-btn {
  background: none; border: none; color: var(--teal-dark);
  font-weight: 600; font-size: 13.5px; padding: 0; margin: 0;
  cursor: pointer; font-family: inherit;
}
.link-btn:hover { text-decoration: underline; background: none; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.pill-green { background: var(--teal-bg); color: var(--teal-dark); }
.pill-grey { background: #eef0f3; color: var(--grey); }
.pill-red { background: #fff1ee; color: #b3261e; }

.pagination {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 22px;
  font-size: 13.5px;
}
.pagination a, .pagination span {
  color: var(--grey);
  text-decoration: none;
  padding: 4px 8px;
}
.pagination a:hover { color: var(--teal-dark); }
.pagination .current { color: #fff; background: var(--navy); border-radius: 4px; font-weight: 700; }
.pagination .disabled { color: var(--grey-light); pointer-events: none; }

.footnote { text-align: center; color: var(--grey-light); font-size: 12px; margin-top: 28px; }

@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .detail-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .card { padding: 22px 18px; }
  .row { flex-direction: column; gap: 0; }
  .navbar-inner { padding: 10px 16px; }
  .page { padding: 20px 12px 48px; }
}

/* --- Login screen --- */

.login-body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

.login-body, .login-body input, .login-body button {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

.login-screen {
  min-height: 100vh;
  display: flex;
}

.login-visual {
  position: relative;
  flex: 0 0 55%;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.login-visual-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-visual-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(9, 33, 30, 0.86) 0%, rgba(10, 44, 39, 0.72) 38%, rgba(14, 60, 53, 0.4) 62%, rgba(10, 44, 39, 0.55) 100%);
}

.login-visual-content {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 72px;
  color: #fff;
}

.login-brand-logo {
  width: 260px;
  max-width: 60%;
  height: auto;
  display: block;
}

.login-brand-sub {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.85);
}

.login-hero h1 {
  margin: 0 0 18px;
  font-size: 48px;
  font-weight: 600;
  line-height: 1.12;
  color: #fff;
}

.login-hero p {
  margin: 0;
  max-width: 460px;
  font-size: 20px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.86);
}

.login-tagline {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}

.login-form-panel {
  flex: 0 0 45%;
  min-height: 100vh;
  background: #faf9f6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  position: relative;
}

.login-form-box {
  width: 100%;
  max-width: 420px;
}

.login-eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--teal);
  margin-bottom: 14px;
}

.login-title {
  margin: 0 0 10px;
  font-size: 36px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.login-desc {
  margin: 0 0 32px;
  font-size: 16px;
  color: var(--grey);
}

.login-form-box label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 8px;
}

.login-form-box input[type="text"],
.login-form-box input[type="password"] {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 15px;
  font-family: inherit;
  color: var(--navy);
  background: #fff;
  margin-bottom: 24px;
}

.login-form-box input[type="text"]:focus,
.login-form-box input[type="password"]:focus {
  outline: none;
  border-color: #103e43;
  box-shadow: 0 0 0 3px rgba(16, 62, 67, 0.12);
}

.login-form-box button {
  width: 100%;
  height: 52px;
  margin-top: 4px;
  background: #103e43;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
}

.login-form-box button:hover { background: #0a2f32; }
.login-form-box button:focus-visible {
  outline: 2px solid #103e43;
  outline-offset: 2px;
}
.login-form-box button:disabled { opacity: 0.75; cursor: default; }

.login-footnote-inline {
  margin: 20px 0 0;
  font-size: 13px;
  color: var(--grey);
  text-align: center;
}

.login-form-footer {
  position: absolute;
  bottom: 28px;
  font-size: 12px;
  color: var(--grey-light);
}

@media (max-width: 880px) {
  .login-screen { flex-direction: column; }

  .login-visual {
    flex: 0 0 auto;
    min-height: 0;
  }

  .login-visual-content {
    padding: 28px 24px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
  }

  .login-brand-logo { width: 160px; }
  .login-brand-sub { margin-top: 4px; font-size: 10px; }
  .login-hero, .login-tagline { display: none; }

  .login-form-panel {
    flex: 1;
    min-height: 0;
    padding: 40px 24px 32px;
  }

  .login-form-footer {
    position: static;
    margin-top: 32px;
  }
}

/* --- Wizard: Generar DeCA --- */

body.wizard-body {
  background: #faf9f6;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

.wizard-page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.wizard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.wizard-title {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  color: #17212b;
}

.wizard-desc { margin: 0; font-size: 14px; color: #6b7280; }

.wizard-status {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  background: #fff;
  border: 1px solid #dde2e5;
  border-radius: 4px;
  padding: 7px 12px;
  margin-top: 2px;
}

.wizard-steps {
  display: flex;
  gap: 32px;
  border-bottom: 1px solid #dde2e5;
  margin-bottom: 24px;
  overflow-x: auto;
}

.wizard-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: #98a2b3;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: default;
}

.wizard-step-item.done { color: #6b7280; cursor: pointer; }
.wizard-step-item.active { color: #103e43; border-bottom-color: #103e43; }

.wizard-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wizard-body-grid {
  display: grid;
  grid-template-columns: 70% 1fr;
  gap: 26px;
  align-items: start;
}

.wizard-main {
  background: #fff;
  border: 1px solid #dde2e5;
  border-radius: 6px;
  padding: 28px 32px;
}

.wizard-panel { display: none; }
.wizard-panel.active { display: block; }

.wizard-panel-title {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 700;
  color: #17212b;
}

.wizard-panel-desc { margin: 0 0 22px; font-size: 13.5px; color: #6b7280; }

.wizard-block-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #103e43;
  margin: 26px 0 6px;
  padding-top: 16px;
  border-top: 1px solid #eef0f3;
}
.wizard-block-title:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }

.wizard-main label { font-size: 13px; }
.wizard-main .opt { font-weight: 400; color: #98a2b3; text-transform: none; letter-spacing: 0; }

.wizard-main input[type="text"],
.wizard-main input[type="email"],
.wizard-main input[type="date"],
.wizard-main input[type="time"] {
  height: 48px;
}

.wizard-main input.input-error {
  border-color: #b3261e;
}

.field-error {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: #b3261e;
  min-height: 0;
}
.field-error:empty { margin: 0; }

.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #eef0f3;
}

.wizard-footer-step { font-size: 13px; color: #6b7280; font-weight: 600; }
.wizard-footer-actions { display: flex; gap: 10px; }

.wizard-footer-actions .btn-next,
.wizard-footer-actions .btn-secondary,
.wizard-footer-actions .btn-secondary-link {
  margin-top: 0;
}

.btn-next {
  background: #103e43;
  color: #fff;
  border: none;
  height: 44px;
  padding: 0 22px;
  border-radius: 4px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-next:hover { background: #0a2f32; }
.btn-next:disabled { opacity: 0.7; cursor: default; }

.btn-secondary,
.btn-secondary-link {
  background: #fff;
  color: #17212b;
  border: 1px solid #dde2e5;
  height: 44px;
  padding: 0 22px;
  border-radius: 4px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.btn-secondary:hover, .btn-secondary-link:hover { background: #f6f7f9; }

/* --- File picker (documento de referencia) --- */

.file-picker {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.file-picker-btn {
  margin-top: 0;
  background: #fff;
  color: #103e43;
  border: 1px solid #dde2e5;
  height: 40px;
  padding: 0 16px;
  border-radius: 4px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.file-picker-btn:hover { background: #f6f7f9; }

.file-picker-name { font-size: 13.5px; color: #6b7280; }

.file-picker-remove {
  margin-top: 0;
  background: none;
  border: none;
  color: #b3261e;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.file-picker-remove:hover { text-decoration: underline; }

/* --- Revisión (paso 4) --- */

.review-block {
  border: 1px solid #eef0f3;
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.review-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.review-block-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #103e43;
}

.review-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13.5px;
  padding: 6px 0;
  border-top: 1px solid #f4f5f7;
}
.review-row:first-of-type { border-top: none; }
.review-row > span:first-child { color: #6b7280; flex-shrink: 0; }
.review-row > span:last-child { color: #17212b; font-weight: 500; text-align: right; }

/* --- Resumen lateral --- */

.wizard-summary {
  background: #fff;
  border: 1px solid #dde2e5;
  border-radius: 6px;
  padding: 22px 22px 20px;
  position: sticky;
  top: 20px;
}

.wizard-summary h2 {
  margin: 0 0 18px;
  font-size: 14px;
  font-weight: 700;
  color: #17212b;
}

.summary-group {
  padding: 14px 0;
  border-top: 1px solid #eef0f3;
}
.summary-group:first-of-type { padding-top: 0; border-top: none; }

.summary-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #98a2b3;
  margin-bottom: 6px;
}

.summary-line { font-size: 13.5px; color: #17212b; font-weight: 500; line-height: 1.4; }
.summary-line.muted { color: #6b7280; font-weight: 400; font-size: 12.5px; }
.summary-line.muted-empty { color: #98a2b3; font-weight: 400; font-style: italic; }

.summary-footnote {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid #eef0f3;
  font-size: 12px;
  color: #98a2b3;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .wizard-body-grid { grid-template-columns: 1fr; }
  .wizard-summary { position: static; margin-top: 24px; }
}

/* --- Elegir camino de generación --- */

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.choice-card {
  background: #fff;
  border: 1px solid #dde2e5;
  border-radius: 6px;
  padding: 28px 26px;
  text-decoration: none;
  display: block;
  transition: border-color 0.15s;
}
.choice-card:hover { border-color: #103e43; }

.choice-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: #17212b;
}

.choice-card p {
  margin: 0 0 20px;
  font-size: 13.5px;
  color: #6b7280;
  line-height: 1.55;
}

.choice-cta {
  font-size: 14px;
  font-weight: 600;
  color: #103e43;
}

@media (max-width: 700px) {
  .choice-grid { grid-template-columns: 1fr; }
}

/* --- Bandeja documental: DeCA generados --- */

.tray-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 56px 64px;
}

.tray-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.tray-eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 6px;
}

.tray-title { margin: 0 0 6px; font-size: 34px; font-weight: 700; color: #17212b; }
.tray-desc { margin: 0; font-size: 14.5px; color: #6b7280; }

.tray-tabs {
  display: flex;
  gap: 30px;
  border-bottom: 1px solid #dde2e5;
  margin-bottom: 24px;
  overflow-x: auto;
}

.tray-tab {
  padding: 0 0 14px;
  font-size: 14.5px;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tray-tab:hover { color: #17212b; }
.tray-tab.active { color: #103e43; border-bottom-color: #103e43; }
.tray-tab-count { color: #98a2b3; font-weight: 500; }
.tray-tab.active .tray-tab-count { color: #103e43; }

.tray-empty {
  background: #fff;
  border: 1px solid #dde2e5;
  border-radius: 6px;
  padding: 48px 24px;
  text-align: center;
  color: #6b7280;
}
.tray-empty p { margin: 0 0 16px; font-size: 14.5px; }

.tray-empty-selection {
  color: #98a2b3;
  font-size: 14px;
  text-align: center;
  padding: 60px 20px;
}

.tray-grid {
  display: grid;
  grid-template-columns: 44% 1fr;
  gap: 30px;
  align-items: start;
}

.tray-search {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.tray-search input[type="search"] {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #dde2e5;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.tray-search button {
  margin-top: 0;
  height: 44px;
  padding: 0 20px;
  background: #103e43;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.tray-search button:hover { background: #0a2f32; }

.tray-results-count { margin: 0 0 12px; font-size: 13px; color: #6b7280; }

.tray-list { display: flex; flex-direction: column; gap: 12px; max-height: 72vh; overflow-y: auto; }

.tray-item {
  background: #fff;
  border: 1px solid #dde2e5;
  border-radius: 6px;
  padding: 24px;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.tray-item:hover { border-color: #c7ced4; }
.tray-item.selected {
  border-left-color: #103e43;
  border-color: #103e43;
}
.tray-item:focus-visible { outline: 2px solid #103e43; outline-offset: 2px; }

.tray-item-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.tray-item-matricula { font-size: 22px; font-weight: 700; color: #17212b; }
.tray-item-fecha { font-size: 12.5px; color: #98a2b3; }
.tray-item-transportista { font-size: 14px; color: #17212b; font-weight: 500; }
.tray-item-nif { font-size: 12.5px; color: #98a2b3; margin-top: 2px; margin-bottom: 12px; }

.tray-item-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tray-item-codigo { font-size: 12px; color: #98a2b3; }

.tray-detail {
  background: #fff;
  border: 1px solid #dde2e5;
  border-radius: 6px;
  padding: 32px;
  position: sticky;
  top: 20px;
}

.tray-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.tray-detail-matricula { margin: 0 0 6px; font-size: 32px; font-weight: 700; color: #17212b; }
.tray-detail-sub { margin: 0; font-size: 13.5px; color: #6b7280; }

.tray-divider { border: none; border-top: 1px solid #eef0f3; margin: 22px 0; }

.tray-block-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #103e43;
  margin: 0 0 12px;
}

.tray-data-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  border-top: 1px solid #f4f5f7;
  font-size: 13.5px;
}
.tray-data-row:first-of-type { border-top: none; }
.tray-data-row > span:first-child { color: #6b7280; flex-shrink: 0; }
.tray-data-row > span:last-child { color: #17212b; font-weight: 500; text-align: right; word-break: break-word; }

.tray-envio-block {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: 6px;
  border: 1px solid;
}
.tray-envio-fail { background: #fff1ee; border-color: #f5c8bf; }
.tray-envio-ok { background: var(--teal-bg); border-color: #bfdfd8; }
.tray-envio-info { background: #f4f5f7; border-color: #dde2e5; }

.tray-envio-title { font-size: 14px; font-weight: 700; color: #17212b; margin-bottom: 4px; }
.tray-envio-desc { margin: 0 0 14px; font-size: 13px; color: #6b7280; line-height: 1.5; }
.tray-envio-block .tray-envio-desc:last-child { margin-bottom: 0; }

.tray-resend-btn { margin-top: 0; height: 42px; padding: 0 18px; font-size: 13.5px; }
.tray-resend-btn:disabled { opacity: 0.7; cursor: default; }

.tray-open-btn {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 22px;
  height: 46px;
  line-height: 46px;
  padding: 0;
}

.tray-detail-back { margin-bottom: 14px; }
.tray-detail-back .link-btn { font-size: 14px; }

@media (max-width: 900px) {
  .tray-page { padding: 28px 20px 48px; }
  .tray-grid { grid-template-columns: 1fr; }
  .tray-detail-col { display: none; }
  .tray-grid.tray-show-detail .tray-list-col { display: none; }
  .tray-grid.tray-show-detail .tray-detail-col { display: block; }
  .tray-detail { position: static; }
  .tray-header { flex-direction: column; gap: 14px; }
}

@media (max-width: 640px) {
  .wizard-page { padding: 20px 14px 48px; }
  .wizard-main { padding: 20px 18px; }
  .wizard-steps { gap: 20px; }
  .wizard-step-item span:last-child { display: none; }
  .wizard-header { flex-direction: column; gap: 10px; }
  .wizard-footer { flex-direction: column; align-items: stretch; gap: 12px; }
  .wizard-footer-actions { justify-content: stretch; }
  .wizard-footer-actions button, .wizard-footer-actions a { flex: 1; text-align: center; justify-content: center; }
}

/* --- Confirmación y detalle de un DeCA generado --- */

.result-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 36px 40px 64px;
}

.result-back {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
  color: #103e43;
  text-decoration: underline;
}
.result-back:hover { color: #0a2f32; }

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.result-title {
  margin: 6px 0 8px;
  font-size: 36px;
  font-weight: 700;
  color: #17212b;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.result-subtitle { margin: 0; font-size: 16px; color: #6b7280; word-break: break-word; }

.result-status-box {
  border-radius: 6px;
  border: 1px solid;
  padding: 24px;
  margin-bottom: 24px;
}
.result-status-box h2 { margin: 0; font-size: 17px; font-weight: 700; color: #17212b; }
.result-status-box p { margin: 6px 0 0; font-size: 13.5px; color: #6b7280; }

.result-status-ok { background: var(--teal-bg); border-color: #bfdfd8; }
.result-status-fail { background: #fff1ee; border-color: #f5c8bf; }
.result-status-info { background: #f4f5f7; border-color: #dde2e5; }

.result-grid {
  display: grid;
  grid-template-columns: 65% 1fr;
  gap: 24px;
  align-items: start;
}

.result-main-col { display: flex; flex-direction: column; gap: 24px; }

.result-card {
  background: #fff;
  border: 1px solid #dde2e5;
  border-radius: 6px;
  padding: 30px;
}

.result-card-title { margin: 6px 0 8px; font-size: 18px; font-weight: 700; color: #17212b; }
.result-card-desc { margin: 0; font-size: 13.5px; color: #6b7280; line-height: 1.5; }

.result-download-btn, .result-link-actions .btn-next, .result-link-actions .btn-secondary {
  margin-top: 18px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.result-link-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.result-link-expired {
  margin: 18px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: #b3261e;
}

.result-side-col .result-card { position: sticky; top: 20px; }

.activity-list { display: flex; flex-direction: column; gap: 18px; }
.activity-time { font-size: 12.5px; color: #98a2b3; margin-bottom: 3px; }
.activity-label { font-size: 14px; font-weight: 600; color: #17212b; }
.activity-extra { font-size: 13px; color: #6b7280; margin-top: 2px; }

.result-expiry-date { margin: 0 0 4px; font-size: 15px; font-weight: 700; color: #17212b; }

@media (max-width: 900px) {
  .result-grid { grid-template-columns: 1fr; }
  .result-side-col .result-card { position: static; }
}

@media (max-width: 640px) {
  .result-page { padding: 24px 20px 48px; }
  .result-card { padding: 22px; }
  .result-title { font-size: 28px; }
  .result-header { flex-direction: column; gap: 12px; }
  .result-link-actions { flex-direction: column; }
  .result-link-actions .btn-next, .result-link-actions .btn-secondary { width: 100%; justify-content: center; }
}

.result-version-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  font-size: 13.5px;
  color: #6b7280;
  font-weight: 600;
}

.result-version-bar select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid #dde2e5;
  border-radius: 4px;
  font-size: 13.5px;
  font-family: inherit;
  color: #17212b;
  background: #fff;
}
