:root {
  --dgii: #0a7a3e;
  --dgii-dark: #065c2e;
  --dgii-deep: #043f20;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 15px/1.45 "Segoe UI", sans-serif;
  color: #0f172a;
  background: #f4f7fb;
}
.topbar { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: var(--dgii); color: #fff; }
.top-nav { display: flex; gap: 8px; }
.top-btn.on { background: #fff; color: var(--dgii); border-color: #fff; }
.api-page { max-width: 980px; margin: 0 auto; padding: 22px 22px 64px; }
.api-page .sheet { margin: 12px 0 16px; }
.acceso-pick { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: #64748b; margin-bottom: 8px; }
.acceso-pick select { text-transform: none; letter-spacing: 0; font: inherit; font-weight: 600; padding: 8px 10px; border: 1px solid #d7e0e8; border-radius: 8px; color: #0f172a; background: #fff; }
.quien { font-size: 0.82rem; opacity: 0.9; align-self: center; }
.filtros { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 14px 0; }
.filtros label { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: #64748b; }
.filtros select { text-transform: none; letter-spacing: 0; font: inherit; font-weight: 600; padding: 8px 10px; border: 1px solid #d7e0e8; border-radius: 8px; min-width: 180px; }
.tabla-wrap { overflow: auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; }
.tabla { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tabla th, .tabla td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #e2e8f0; }
.tabla th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; }
.mini { font: inherit; font-size: 0.75rem; margin-left: 6px; padding: 4px 8px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, #0a7a3e 0%, #043f20 100%); }
.login-card { width: min(420px, 100%); background: #fff; border-radius: 16px; padding: 22px; }
.login-card h1 { margin: 4px 0 8px; font-size: 1.35rem; }
.login-card p { margin: 0 0 14px; color: #64748b; }
.login-card label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 0.85rem; color: #334155; }
.login-card input { font: inherit; padding: 8px 10px; border: 1px solid #d7e0e8; border-radius: 8px; }
.api-sub { color: #64748b; }
.ruta-path { display: block; margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #fff; color: #1e3a8a; word-break: break-all; }
#api-ejemplo { background: #0b1220; color: #bbf7d0; border-radius: 12px; padding: 14px; overflow: auto; font-size: 0.78rem; line-height: 1.45; }
.api-envios { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.api-envios li { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; gap: 12px; }
.api-msg { color: var(--dgii); font-weight: 700; }
.top-btn, .btn, .link, .nueva-side, .step {
  font: inherit;
  cursor: pointer;
}
.top-btn {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 8px;
  padding: 6px 12px;
}
.lab-layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 300px;
  align-items: start;
  min-height: calc(100vh - 56px);
}
.lab-steps {
  background: linear-gradient(180deg, #0a7a3e 0%, #065c2e 55%, #043f20 100%);
  color: #e8f8ee;
  padding: 16px 10px 24px;
  position: sticky;
  top: 0;
  max-height: calc(100vh - 56px);
  overflow: auto;
}
.aside-brand { padding: 4px 8px 10px; }
.aside-kicker, .dgii-kicker, .kicker, .dgii-info-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.aside-kicker { color: #bbf7d0; }
.aside-h { margin: 6px 0 2px; font-size: 1.05rem; font-weight: 800; color: #fff; }
.aside-sub { margin: 0; font-size: 0.78rem; color: #a7f3d0; }
.empresa-lab {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 8px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #bbf7d0;
}
.empresa-lab select {
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #043f20;
  background: #fff;
  text-transform: none;
  letter-spacing: 0;
}
.empresa-lab em {
  font-style: normal;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.72rem;
  color: #d1fae5;
}
.nueva-side {
  margin: 0 8px 12px;
  width: calc(100% - 16px);
  background: transparent;
  color: #ecfdf5;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 8px;
  padding: 7px 8px;
}
.aside-progress { margin: 0 8px 14px; }
.aside-progress span { display: block; margin-top: 6px; font-size: 0.72rem; color: #d1fae5; }
.bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.18); overflow: hidden; }
.bar i { display: block; height: 100%; background: #86efac; border-radius: 99px; }
.step {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 8px;
  color: inherit;
  margin-bottom: 2px;
}
.step:hover { background: rgba(255,255,255,.08); }
.step.actual { background: rgba(134,239,172,.18); box-shadow: inset 0 0 0 1px rgba(187,247,208,.45); }
.step .n {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #ecfdf5;
  background: rgba(255,255,255,.12);
}
.step.ok .n { background: #22c55e; border-color: #22c55e; color: #fff; }
.step .meta { display: flex; flex-direction: column; min-width: 0; }
.step .meta strong { font-size: 0.8rem; font-weight: 700; color: #fff; line-height: 1.25; }
.step .meta em { font-style: normal; font-size: 0.7rem; color: #a7f3d0; text-transform: uppercase; }
.step.ok .meta em { color: #86efac; }
.lab-detail { background: #fff; padding: 18px 22px 48px; border-right: 1px solid #e2e8f0; min-height: calc(100vh - 56px); }
.lab-hero, .detail-head, .actions { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.lab-hero { margin-bottom: 12px; }
.lab-hero h1, .detail-head h2 { margin: 0; font-size: 1.28rem; font-weight: 800; }
.lab-hero p { margin: 4px 0 0; color: #64748b; font-size: 0.9rem; }
.kicker { color: var(--dgii); }
.detail-head { margin-bottom: 16px; }
.detail-head h2 { margin-top: 2px; }
.badge { border-radius: 999px; padding: 4px 10px; font-size: 0.75rem; font-weight: 800; background: #e2e8f0; color: #334155; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.wait { background: #fef3c7; color: #92400e; }
.aviso-hist {
  margin: 0 0 12px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.86rem;
}
.dgii-info { background: #e8f4fc; border: 1px solid #b6d9ef; border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; color: #1e3a4c; }
.dgii-info p { margin: 0; font-size: 0.86rem; line-height: 1.5; }
.dgii-info-kicker { margin: 0 0 8px !important; color: #0e7490; }
.guia { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.guia article { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px; padding: 12px; }
.guia h3 { margin: 0 0 6px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dgii); }
.guia p { margin: 0; font-size: 0.82rem; color: #334155; }
.card-ruta { margin: 0 0 14px; padding: 14px 16px; border: 1px solid #bfdbfe; border-radius: 12px; background: #eff6ff; }
.card-ruta strong { display: block; color: #1e3a8a; }
.card-ruta code { display: block; margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #fff; color: #1e3a8a; word-break: break-all; }
.btn { background: var(--dgii); color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 700; }
.btn.ghost { background: #fff; color: var(--dgii); border: 1px solid var(--dgii); }
.link { background: none; border: 0; color: #64748b; padding: 10px 0; }
.firma { margin-top: 22px; padding-top: 16px; border-top: 1px solid #e2e8f0; }
.firma h3 { margin: 0 0 6px; font-size: 0.95rem; }
.firma p, .firma label { color: #64748b; font-size: 0.85rem; }
.firma input, .grid input { display: block; width: 100%; margin-top: 4px; font: inherit; padding: 8px 10px; border: 1px solid #d7e0e8; border-radius: 8px; color: #0f172a; background: #fff; }
.dgii { background: #0b1220; color: #d7e3f4; padding: 16px 14px 24px; position: sticky; top: 0; min-height: calc(100vh - 56px); }
.dgii h3 { margin: 2px 0 0; font-size: 0.98rem; color: #fff; }
.dgii-kicker { color: #86efac; }
.dgii-empty { margin: 12px 0 0; color: #64748b; font-size: 0.82rem; }
.empty, .sheet { max-width: 860px; margin: 22px auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 20px; }
.sheet-h { display: flex; justify-content: space-between; align-items: center; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid label, .firma label { display: flex; flex-direction: column; }
.wide { grid-column: 1 / -1; }
.error { color: #9d1c1c; }
.casos { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 0.8rem; }
.casos th, .casos td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
.casos th { color: #64748b; font-weight: 600; }
.casos .msg { max-width: 220px; color: #334155; }
.casos button { background: none; border: 0; color: var(--dgii); font-weight: 700; padding: 0 6px 0 0; cursor: pointer; }
.dgii pre { white-space: pre-wrap; word-break: break-word; font-size: 0.75rem; color: #d7e3f4; }
@media (max-width: 1100px) {
  .lab-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .dgii { grid-column: 1 / -1; position: relative; min-height: 0; }
  .guia { grid-template-columns: 1fr; }
}
