/* Modal cargado desde docs/facturacion-modal.html */
.docs-modal {
  width: min(960px, calc(100% - 32px));
  max-width: none;
  max-height: min(88vh, 900px);
  margin: auto;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(82, 127, 166, 0.72);
  border-radius: 14px;
  background: #09182b;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
  color: var(--text);
}

.docs-modal[open] {
  animation: docs-modal-in 180ms ease-out;
}

.docs-modal::backdrop {
  background: rgba(1, 7, 16, 0.8);
  backdrop-filter: blur(7px);
}

.docs-modal__frame {
  display: flex;
  max-height: min(88vh, 900px);
  flex-direction: column;
}

.docs-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at 0 0, rgba(34, 211, 238, 0.13), transparent 45%),
    rgba(7, 19, 35, 0.96);
}

.docs-modal__header .pixel-label {
  margin-bottom: 8px;
}

.docs-modal__header h2 {
  margin-bottom: 0;
  font-size: clamp(23px, 4vw, 31px);
}

.docs-modal__close {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(15, 31, 52, 0.88);
  color: var(--text);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.docs-modal__close:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  transform: rotate(4deg);
}

.docs-modal__content {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px;
  scrollbar-color: rgba(34, 211, 238, 0.6) rgba(7, 16, 31, 0.45);
}

.docs-modal__content[aria-busy="true"] {
  min-height: 260px;
}

.docs-modal__loading {
  display: grid;
  min-height: 210px;
  place-items: center;
  color: var(--muted);
}

.docs-modal__error {
  padding-block: 36px;
  text-align: center;
}

.docs-modal__error p {
  margin: 10px 0 24px;
  color: var(--muted);
}

.docs-summary__lead {
  max-width: 790px;
  margin-bottom: 22px;
  color: #cbd8e6;
  font-size: 17px;
  line-height: 1.8;
}

.docs-notice,
.docs-callout {
  padding: 18px 20px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-left: 3px solid var(--cyan);
  border-radius: 7px;
  background: rgba(34, 211, 238, 0.075);
}

.docs-notice strong,
.docs-callout strong {
  color: var(--text);
}

.docs-notice p,
.docs-callout p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.docs-summary__grid {
  display: grid;
  gap: 14px;
  margin-top: 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.docs-summary__grid section {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(12, 30, 52, 0.68);
}

.docs-summary__grid .pixel-label {
  margin-bottom: 12px;
}

.docs-summary__grid h3 {
  margin-bottom: 8px;
}

.docs-summary__grid p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.docs-summary code,
.docs-content code {
  font-family: var(--font-mono);
}

.docs-summary p code,
.docs-content p code,
.docs-content td code,
.docs-content dd code {
  padding: 2px 5px;
  border: 1px solid rgba(74, 108, 145, 0.46);
  border-radius: 4px;
  background: rgba(3, 12, 27, 0.62);
  color: #a5f3fc;
  font-size: 0.88em;
}

.docs-summary__section {
  margin-top: 30px;
}

.docs-summary__section > h3 {
  margin-bottom: 14px;
}

.docs-summary__heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 15px;
}

.docs-summary__heading .pixel-label {
  margin-bottom: 8px;
}

.docs-summary__heading h3 {
  margin-bottom: 0;
}

.docs-version-badge {
  padding: 6px 8px;
  border: 1px solid rgba(139, 92, 246, 0.44);
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.09);
  color: #c4b5fd;
  font-family: var(--font-mono);
  font-size: 11px;
}

.docs-endpoint-list {
  display: grid;
  gap: 9px;
}

.docs-endpoint-list li {
  display: grid;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: rgba(4, 15, 30, 0.55);
  grid-template-columns: minmax(230px, 0.7fr) 1fr;
}

.docs-endpoint-list code {
  color: #67e8f9;
  font-size: 12px;
  font-weight: 600;
}

.docs-endpoint-list span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.docs-code {
  overflow-x: auto;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #030e1b;
  color: #c4f1f9;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.8;
}

.docs-response-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.docs-response-grid > div {
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(3, 14, 27, 0.56);
}

.docs-response-grid strong {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

.docs-response-grid p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot--ok {
  background: #34d399;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.72);
}

.status-dot--error {
  background: #fb7185;
  box-shadow: 0 0 10px rgba(251, 113, 133, 0.72);
}

.docs-summary__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.docs-summary__footer p {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

/* Página completa */
.documentation-page {
  background:
    radial-gradient(circle at 12% 0%, rgba(34, 211, 238, 0.1), transparent 31rem),
    radial-gradient(circle at 92% 72%, rgba(139, 92, 246, 0.09), transparent 34rem),
    linear-gradient(rgba(72, 105, 139, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 105, 139, 0.18) 1px, transparent 1px),
    var(--background);
  background-attachment: fixed;
  background-position: 0 0, 0 0, -1px -1px, -1px -1px, 0 0;
  background-size: auto, auto, 32px 32px, 32px 32px, auto;
}

.docs-header {
  position: sticky;
  z-index: 60;
  top: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 16, 31, 0.92);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
}

.docs-header__inner {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 24px;
}

.docs-header__title {
  padding-left: 24px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.docs-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.docs-menu-button {
  display: none;
  min-height: 38px;
  padding-inline: 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(12, 26, 46, 0.74);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.documentation-layout {
  display: grid;
  align-items: start;
  gap: 54px;
  padding-block: 52px 90px;
  grid-template-columns: 230px minmax(0, 1fr);
}

.docs-sidebar {
  position: sticky;
  top: 104px;
}

.docs-sidebar nav {
  display: grid;
  gap: 3px;
}

.docs-sidebar .pixel-label {
  margin-bottom: 12px;
}

.docs-sidebar a {
  padding: 9px 11px;
  border-left: 2px solid transparent;
  border-radius: 0 5px 5px 0;
  color: var(--muted);
  font-size: 13px;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.docs-sidebar a:hover {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.075);
  color: var(--cyan);
  transform: translateX(3px);
}

.docs-sidebar__meta {
  display: grid;
  gap: 6px;
  margin-top: 22px;
  padding: 14px 11px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted-dark);
  font-family: var(--font-mono);
  font-size: 10px;
}

.docs-sidebar__meta strong {
  color: var(--muted);
  font-weight: 500;
}

.docs-content {
  width: min(100%, 920px);
}

.docs-hero {
  padding: 24px 0 36px;
  border-bottom: 1px solid var(--border);
}

.docs-hero h1 {
  max-width: 780px;
  margin-bottom: 18px;
  font-size: clamp(40px, 6vw, 66px);
  letter-spacing: -0.05em;
  line-height: 1.05;
}

.docs-hero__lead {
  max-width: 760px;
  margin-bottom: 24px;
  color: #b8c7d8;
  font-size: 19px;
  line-height: 1.75;
}

.docs-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.docs-meta-row span {
  padding: 6px 8px;
  border: 1px solid rgba(34, 211, 238, 0.31);
  border-radius: 3px;
  background: rgba(34, 211, 238, 0.075);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 10px;
}

.docs-content > .docs-callout {
  margin-top: 28px;
}

.docs-callout--warning {
  border-color: rgba(251, 191, 36, 0.34);
  border-left-color: #fbbf24;
  background: rgba(251, 191, 36, 0.065);
}

.docs-callout--info {
  border-color: rgba(139, 92, 246, 0.38);
  border-left-color: #a78bfa;
  background: rgba(139, 92, 246, 0.075);
}

.docs-section {
  padding-block: 58px;
  border-bottom: 1px solid var(--border-soft);
  scroll-margin-top: 72px;
}

.docs-section > .pixel-label {
  margin-bottom: 13px;
}

.docs-section h2 {
  margin-bottom: 16px;
  font-size: clamp(29px, 4vw, 39px);
  letter-spacing: -0.035em;
}

.docs-section h3 {
  margin: 34px 0 13px;
  font-size: 20px;
}

.docs-section > p {
  max-width: 810px;
  color: var(--muted);
  line-height: 1.8;
}

.docs-facts {
  display: grid;
  gap: 12px;
  margin-top: 26px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.docs-facts > div {
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(9, 24, 43, 0.72);
}

.docs-facts dt {
  margin-bottom: 8px;
  color: var(--muted-dark);
  font-family: var(--font-pixel);
  font-size: 7px;
}

.docs-facts dd {
  margin: 0;
}

.docs-code-block {
  overflow: hidden;
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #030e1b;
}

.docs-code-block__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 28, 48, 0.88);
  color: var(--muted);
  font-size: 11px;
}

.docs-code-block__bar code {
  color: var(--cyan);
}

.docs-code-block pre,
.docs-response pre {
  margin: 0;
  overflow-x: auto;
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.85;
  tab-size: 2;
}

.docs-code-block pre {
  padding: 20px;
}

.docs-section .docs-callout {
  margin-top: 24px;
}

.docs-response {
  display: grid;
  overflow: hidden;
  align-items: stretch;
  margin-top: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #030e1b;
  grid-template-columns: 74px minmax(0, 1fr);
}

.docs-response pre {
  padding: 17px 19px;
}

.docs-http {
  display: grid;
  place-items: center;
  border-right: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

.docs-http--ok {
  background: rgba(52, 211, 153, 0.1);
  color: #6ee7b7;
}

.docs-http--error {
  background: rgba(251, 113, 133, 0.1);
  color: #fda4af;
}

.docs-http--neutral {
  background: rgba(251, 191, 36, 0.1);
  color: #fde68a;
}

.docs-flow {
  display: grid;
  gap: 11px;
  margin-top: 28px;
}

.docs-flow li {
  display: flex;
  gap: 18px;
  padding: 19px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(9, 24, 43, 0.64);
}

.docs-flow li > span {
  color: var(--cyan);
  font-family: var(--font-pixel);
  font-size: 13px;
  line-height: 1.7;
}

.docs-flow strong {
  color: var(--text);
}

.docs-flow p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.docs-endpoint-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 16px;
}

.docs-endpoint-heading h2 {
  margin-bottom: 0;
  font-size: clamp(25px, 4vw, 34px);
}

.docs-endpoint-heading h2 code {
  color: var(--text);
  font-family: var(--font-mono);
}

.docs-method {
  padding: 7px 9px;
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 4px;
  background: rgba(52, 211, 153, 0.1);
  color: #6ee7b7;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.docs-table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.docs-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(4, 15, 30, 0.66);
  font-size: 13px;
}

.docs-table-wrap th,
.docs-table-wrap td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

.docs-table-wrap th {
  background: rgba(14, 33, 55, 0.92);
  color: #c8d5e2;
  font-size: 11px;
}

.docs-table-wrap td {
  color: var(--muted);
  line-height: 1.6;
}

.docs-table-wrap tr:last-child td {
  border-bottom: 0;
}

.docs-table-wrap td:first-child {
  color: #a5f3fc;
  white-space: nowrap;
}

.docs-caption {
  margin-top: 11px;
  color: var(--muted-dark) !important;
  font-size: 11px;
}

.docs-status-list {
  display: grid;
  gap: 11px;
  margin-top: 25px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.docs-status-list > div {
  display: grid;
  align-items: start;
  gap: 3px 12px;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(9, 24, 43, 0.64);
  grid-template-columns: 31px 1fr;
}

.docs-status-list code {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(34, 211, 238, 0.38);
  border-radius: 4px;
  background: rgba(34, 211, 238, 0.08);
  color: var(--cyan);
  grid-row: span 2;
}

.docs-status-list strong {
  color: var(--text);
  font-size: 13px;
}

.docs-status-list p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.docs-checklist {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.docs-checklist li {
  position: relative;
  padding: 16px 18px 16px 46px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(9, 24, 43, 0.64);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.docs-checklist li::before {
  position: absolute;
  top: 17px;
  left: 18px;
  content: "✓";
  color: #6ee7b7;
  font-family: var(--font-mono);
  font-weight: 700;
}

.docs-checklist strong {
  color: var(--text);
}

.docs-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  padding: 58px 0 20px;
}

.docs-footer h2 {
  max-width: 580px;
  margin-bottom: 12px;
  font-size: clamp(27px, 4vw, 38px);
}

.docs-footer p:not(.pixel-label) {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.docs-footer .button-row {
  flex: 0 0 auto;
  margin-top: 0;
}

@keyframes docs-modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
}

@media (max-width: 900px) {
  .docs-header__title {
    display: none;
  }

  .docs-menu-button {
    display: inline-flex;
    align-items: center;
  }

  .documentation-layout {
    display: block;
    padding-top: 34px;
  }

  .docs-sidebar {
    position: fixed;
    z-index: 70;
    top: 82px;
    right: 20px;
    left: 20px;
    max-height: calc(100vh - 102px);
    overflow-y: auto;
    padding: 19px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(7, 19, 35, 0.98);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  }

  .docs-sidebar[hidden] {
    display: none;
  }

  .docs-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 680px) {
  .docs-modal {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
  }

  .docs-modal__frame {
    max-height: calc(100vh - 16px);
  }

  .docs-modal__header,
  .docs-modal__content {
    padding: 18px;
  }

  .docs-summary__grid,
  .docs-response-grid,
  .docs-facts,
  .docs-status-list {
    grid-template-columns: 1fr;
  }

  .docs-endpoint-list li {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .docs-summary__heading,
  .docs-summary__footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .docs-header__actions .button {
    display: none;
  }

  .docs-hero {
    padding-top: 12px;
  }

  .docs-hero h1 {
    font-size: clamp(36px, 11vw, 52px);
  }

  .docs-hero__lead {
    font-size: 16px;
  }

  .docs-section {
    padding-block: 45px;
  }

  .docs-code-block pre,
  .docs-response pre {
    font-size: 10px;
  }

  .docs-response {
    grid-template-columns: 1fr;
  }

  .docs-http {
    min-height: 38px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .docs-endpoint-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .docs-footer .button-row,
  .docs-footer .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .docs-modal[open] {
    animation: none;
  }
}
