/*
  Tokens visuales — Dökka Autogestión
  Colores tomados directamente de los mockups del documento de
  requerimientos (azul de acción #1D8CF8 y azul marino #003E7E del login):
  fondo gris muy claro, tarjetas blancas, botones tipo "pill", tipografía Inter.
*/
:root {
  --color-navy: #003e7e;
  --color-action: #1d8cf8;
  --color-action-hover: #0d74d9;
  --color-danger: #c62828;
  --color-success: #1fa04a;
  --color-success-dark: #17693a;
  --color-success-bg: #ecfbf0;
  --color-danger-bg: #fdecec;

  --color-bg: #f5f6f8;
  --color-surface: #ffffff;
  --color-border: #dfe4ea;
  --color-text: #16202b;
  --color-text-muted: #64748b;

  --radius-card: 16px;
  --radius-pill: 999px;
  --radius-input: 10px;

  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-card-hover: 0 4px 12px rgba(16, 24, 40, 0.08);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  color: var(--color-navy);
  font-weight: 700;
  margin: 0;
}

p { margin: 0; }

a {
  color: var(--color-action);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

button { font-family: inherit; }

/* Foco visible para accesibilidad (HU-001, prueba UX: navegación mediante teclado) */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--color-action);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* Solo para lectores de pantalla: etiqueta accesible sin alterar el diseño del mockup. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Enlace "Saltar al contenido" (WCAG 2.4.1): visible solo al recibir el foco. */
.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 10;
  background: var(--color-navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-input);
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------- Clases utilitarias compartidas ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 150ms ease;
}
.btn:hover { text-decoration: none; }
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--color-action);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--color-action-hover); }

.btn-ghost {
  display: inline-block;
  background: transparent;
  color: var(--color-navy);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--color-bg); text-decoration: none; }

.card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}
.form-field input {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  padding: 16px 20px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--color-text);
  background: #fff;
}
.form-field input::placeholder { color: var(--color-text-muted); }
.form-field input:focus { border-color: var(--color-action); }
.form-field input[aria-invalid='true'] { border-color: var(--color-danger); }
.form-field .field-error {
  color: var(--color-danger);
  font-size: 0.8rem;
}
.form-field .field-error:empty { display: none; }

.form-field label {
  font-size: 0.85rem;
  color: var(--color-text);
}

.form-error {
  color: var(--color-danger);
  background: var(--color-danger-bg);
  border-radius: var(--radius-input);
  font-size: 0.85rem;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.form-info {
  width: 100%;
  color: var(--color-navy);
  background: #e8f2fe;
  border-radius: var(--radius-input);
  font-size: 0.85rem;
  padding: 10px 14px;
  margin-bottom: 16px;
  text-align: left;
}

/* Recuadro verde de confirmación (mockup de HU-002). */
.form-success {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-align: left;
  color: var(--color-success-dark);
  background: var(--color-success-bg);
  border: 1px solid var(--color-success);
  border-radius: 12px;
  padding: 16px 18px;
  margin-top: 24px;
}
.form-success .success-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
}
.form-success .success-icon svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.form-success strong { display: block; font-size: 0.95rem; margin-bottom: 4px; }
.form-success span { font-size: 0.82rem; }

/* ---------- Pantallas de autenticación (login, recuperación, cambio de contraseña) ---------- */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  padding: 36px 44px 44px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.auth-card h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.auth-card form {
  width: 100%;
  text-align: left;
}

.subtitle {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  margin: 10px 0 32px;
}

/* Ícono dentro de un círculo celeste (sobre, candado) de los mockups de HU-002/HU-003. */
.icon-circle {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: #eaf3fd;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  color: var(--color-navy);
}
.icon-circle svg { width: 56px; height: 56px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.btn-block {
  width: 100%;
  padding: 16px 24px;
  margin-top: 12px;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.back-link,
.forgot-link {
  margin-top: 24px;
  font-size: 0.95rem;
  color: var(--color-navy);
}

.logo {
  width: 68px;
  height: auto;
  margin-bottom: 20px;
}

/* HU-001 CA-005: botón de mostrar/ocultar dentro del campo de contraseña. */
.password-input { position: relative; }
.password-input input { padding-right: 52px; }

.toggle-visibility {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--color-text-muted);
  cursor: pointer;
}
.toggle-visibility:hover { color: var(--color-navy); }
.toggle-visibility svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.toggle-visibility svg[hidden] { display: none; }

@media (max-width: 480px) {
  .auth-card { padding: 28px 20px 32px; }
  .auth-card h1 { font-size: 1.5rem; }
  .subtitle { font-size: 1rem; }
}

/* ---------- "Cambiar Contraseña" (HU-003): campos a la izquierda, requisitos a la derecha ---------- */

.change-card {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 56px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.change-card h1 {
  font-size: 2rem;
  font-weight: 800;
}
.change-card form {
  width: 100%;
  text-align: left;
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  gap: 32px 48px;
  align-items: start;
}

.requirements {
  margin-top: 26px;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 22px 28px;
}
.requirements h2 {
  font-size: 1rem;
  margin-bottom: 14px;
}
.requirements ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.requirements li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
.requirements li.met { color: var(--color-success-dark); font-weight: 600; }
.requirements .check { font-weight: 700; }

.actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.submit {
  min-width: 360px;
  padding: 16px 32px;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

@media (max-width: 760px) {
  .change-card { padding: 28px 20px 32px; }
  .change-card h1 { font-size: 1.5rem; }
  .columns { grid-template-columns: 1fr; gap: 8px; }
  .requirements { margin-top: 0; margin-bottom: 16px; }
  .submit { min-width: 0; width: 100%; }
}

/* ---------- Cascarón de las pantallas autenticadas (sidebar + barra superior) ---------- */

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

.sidebar {
  width: 140px;
  flex-shrink: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid transparent;
  padding: 22px 8px;
  color: var(--color-navy);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  transition: box-shadow 150ms ease, border-color 150ms ease;
}
.nav-item:hover { text-decoration: none; box-shadow: var(--shadow-card-hover); }
.nav-item.active { border-color: var(--color-action); }

.nav-icon {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 32px;
}

.account-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.account-name {
  font-weight: 700;
  color: var(--color-navy);
  font-size: 0.95rem;
}
.account-number {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.topbar-actions form { margin: 0; }
.topbar-actions a.btn-ghost.active { border-color: var(--color-action); color: var(--color-action); }

.content {
  flex: 1;
  padding: 8px 32px 40px;
}
.content:focus { outline: none; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 12px 16px 0;
  }
  .nav-item { flex-direction: row; padding: 12px 16px; }
  .nav-icon { width: 22px; height: 22px; }
  .topbar { padding: 16px; }
  .content { padding: 8px 16px 32px; }
}

/* ---------- "Mi Cuenta": Cuenta Corriente (HU-004 / HU-005), según el mockup ---------- */

.breadcrumb {
  display: flex;
  gap: 10px;
  background: var(--color-surface);
  border-radius: var(--radius-input);
  padding: 14px 20px;
  margin-bottom: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-navy);
  letter-spacing: 0.02em;
}

.account-card { margin-bottom: 20px; }

.account-header {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.icon-circle.small {
  width: 84px;
  height: 84px;
  margin: 0;
  background: #eef0f3;
}
.icon-circle.small svg { width: 40px; height: 40px; stroke-width: 1.8; }

.account-title {
  flex: 1;
  min-width: 220px;
}
.account-title h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.account-title p { font-size: 0.9rem; color: var(--color-text); }

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 6px 4px;
  color: var(--color-action);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.download-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.download-error { margin: 20px 0 0; }

.amounts {
  margin-top: 28px;
  background: var(--color-bg);
  border-radius: 14px;
  padding: 28px 20px;
  text-align: center;
}

.available {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-navy);
}
.available strong { white-space: nowrap; }

.secondary {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px 96px;
  margin: 22px 0 0;
}
.secondary dt { font-size: 1rem; color: var(--color-text-muted); letter-spacing: 0.02em; }
.secondary dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: 800; color: var(--color-navy); }

.balance-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 0;
  background: var(--color-danger-bg);
  border-radius: var(--radius-input);
  padding: 4px 8px 4px 0;
}
.balance-error .form-error { margin: 0; }

/* ---------- Información del cliente (HU-001 CA-001), entre la ruta y Cuenta Corriente ---------- */

.client-card { margin-bottom: 20px; }
.client-card h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.client-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 0;
}
.client-info dt {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.client-info dd {
  margin: 0;
  font-weight: 600;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .available { font-size: 1.2rem; }
  .secondary dd { font-size: 1.1rem; }
}

/* ---------- HU-006: facturas pendientes y notas de crédito (según el mockup) ---------- */

.documents { margin-top: 28px; }

.doc-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--color-border);
}
.doc-tab {
  text-align: center;
  padding: 14px 8px;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
}
.doc-tab:hover { text-decoration: none; color: var(--color-navy); }
.doc-tab.active { background: var(--color-surface); color: var(--color-navy); font-weight: 800; }

.doc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 14px;
}
.doc-sort { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-sort {
  display: inline-block;
  padding: 9px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  color: var(--color-action);
  font-weight: 600;
  font-size: 0.9rem;
}
.btn-sort:hover { text-decoration: none; background: var(--color-bg); }
.btn-sort.active { border-color: var(--color-action); background: #e8f2fe; color: var(--color-navy); }

.doc-refresh { display: flex; align-items: center; gap: 10px; margin: 0; }
.doc-synced { color: var(--color-text-muted); font-size: 0.8rem; }
.doc-message { margin: 0 0 14px; }
.doc-empty { color: var(--color-text-muted); padding: 16px 4px; }

.doc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.doc-key {
  display: inline-block;
  background: #e9eff5;
  color: var(--color-navy);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 6px 14px;
  border-radius: 8px 8px 0 0;
  border: 1px solid var(--color-border);
  border-bottom: none;
  overflow-wrap: anywhere;
}
.doc-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(0, 3fr);
  gap: 12px 24px;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 0 10px 10px 10px;
  padding: 14px 18px;
  background: var(--color-surface);
}
.doc-title strong { display: block; color: var(--color-text); font-size: 0.98rem; }

.status {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
}
/* Colores del mockup con texto oscuro: contraste AA (WCAG 1.4.3). */
.status-pending { background: #fde4ea; color: #8a1538; }
.status-review { background: #fff4c2; color: #6b5300; }
.status-approval { background: #e7eefc; color: #1e3a8a; }
.status-paid { background: #e2f4e8; color: #17693a; }
.status-overdue { background: #fdecec; color: #a11d1d; }
.status-available { background: #e8f2fe; color: var(--color-navy); }

.doc-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px 16px;
  margin: 0;
}
.doc-fields dt { font-size: 0.7rem; color: var(--color-text-muted); letter-spacing: 0.04em; }
.doc-fields dd { margin: 2px 0 0; font-weight: 700; color: var(--color-text); white-space: nowrap; }

@media (max-width: 760px) {
  .doc-row { grid-template-columns: 1fr; }
  .doc-toolbar { flex-direction: column; align-items: stretch; }
  .doc-refresh { justify-content: space-between; }
}

/* ---------- HU-007 Formulario de pago ---------- */

.pay-action { display: flex; align-items: center; }
.btn-pay { padding: 12px 22px; font-size: 0.85rem; box-shadow: 0 4px 10px rgba(29, 140, 248, 0.3); }
.balance-error .btn-pay { margin-left: auto; }
.payment-success { margin: 20px 0 0; }

.btn-success { background: var(--color-success); color: #fff; border-radius: 8px; }
.btn-success:hover:not(:disabled) { background: var(--color-success-dark); }

.breadcrumb a { color: var(--color-navy); }

.payment-card { margin-bottom: 20px; }
.payment-card .account-title h1 { font-size: 1.8rem; letter-spacing: 0.02em; }
.payment-card .account-title p { text-transform: uppercase; font-size: 0.85rem; }
.payment-errors .form-error { margin: 20px 0 0; white-space: pre-line; }

.payment-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px 48px;
  margin-top: 24px;
}
.payment-fields .form-field select,
.payment-side input[type='file'] {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  padding: 14px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--color-text);
  background: #fff;
}
.payment-side input[type='file'] { padding: 10px 12px; }
.payment-fields .form-field select:focus { border-color: var(--color-action); }
.payment-fields .form-field select[aria-invalid='true'],
.payment-side input[aria-invalid='true'] { border-color: var(--color-danger); }
.receipt-hint { font-size: 0.8rem; color: var(--color-text-muted); }

.receipt-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.receipt-chip[hidden] { display: none; }
.receipt-chip > svg { flex: none; width: 36px; height: 36px; fill: none; stroke: var(--color-action); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.receipt-remove {
  flex: none;
  display: inline-flex;
  border: none;
  background: transparent;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--color-danger);
}
.receipt-remove:hover { background: var(--color-danger-bg); }
.receipt-remove svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.payment-total { margin-bottom: 18px; }
.total-line { font-size: 1.25rem; font-weight: 800; color: var(--color-text); }
.total-line strong { white-space: nowrap; border-bottom: 2px solid var(--color-text); }
.total-difference { margin-top: 6px; font-size: 0.85rem; color: var(--color-text-muted); }

.payment-docs { margin-bottom: 20px; }
.section-title { font-size: 1.3rem; font-weight: 500; color: var(--color-text-muted); margin-bottom: 14px; letter-spacing: 0.02em; }
.payment-docs .field-error { display: block; color: var(--color-danger); font-size: 0.85rem; margin-bottom: 10px; }
.payment-docs .field-error:empty { display: none; }
.doc-list.selectable .doc-row { border-radius: 10px; }
.doc-list.selectable .doc-title { display: flex; align-items: flex-start; gap: 14px; }
.doc-list.selectable .doc-title label { cursor: pointer; }
.doc-list.selectable input[type='checkbox'] {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--color-success);
  cursor: pointer;
}
.doc-list.selectable .doc-item:has(input:checked) .doc-row { border-color: var(--color-success); background: var(--color-success-bg); }
.payment-synced { display: block; margin-top: 14px; }

.payment-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 16px 28px;
}

@media (max-width: 760px) {
  .payment-columns { grid-template-columns: 1fr; }
  .payment-card .account-title h1 { font-size: 1.4rem; }
  .payment-footer { justify-content: space-between; }
  .secondary .pay-action { order: 3; width: 100%; justify-content: center; }
}
.doc-to-pay dd { color: var(--color-navy); }

/* ---------- HU-008 Estado de solicitudes / HU-009 Detalle ---------- */

.requests-card { margin-bottom: 20px; }
.requests-card .account-title h1 { font-size: 1.8rem; letter-spacing: 0.02em; }
.requests-card .account-title p { text-transform: uppercase; font-size: 0.85rem; }
.requests-card .account-header .btn-ghost { margin-left: auto; align-self: flex-start; }
.requests-create { margin-left: auto; align-self: center; }
.requests-subtitle { margin: 28px 0 14px; color: var(--color-navy); }

.table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: 12px; }
.requests-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.requests-table th {
  text-align: left;
  font-weight: 500;
  color: var(--color-text-muted);
  background: #f7f9fb;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.requests-table td { padding: 14px 18px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.requests-table tbody tr:last-child td { border-bottom: none; }
.requests-table .num { text-align: right; white-space: nowrap; }
.requests-table .actions { white-space: nowrap; }

.request-status {
  display: inline-block;
  min-width: 110px;
  text-align: center;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: none;
}
/* Colores del mockup con contraste AA (WCAG 1.4.3). */
.request-pending { background: #fff1c7; color: #6b4e00; }
.request-approved { background: #e2f4e8; color: #17693a; }
.request-applied { background: #d9f0e3; color: #0f5132; }
.request-rejected { background: #fdecec; color: #a11d1d; }

.icon-action {
  display: inline-flex;
  padding: 6px;
  border-radius: 8px;
  color: var(--color-navy);
}
.icon-action:hover { background: var(--color-bg); }
.icon-action svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 18px; }
.pager-status { color: var(--color-text-muted); font-size: 0.9rem; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px 28px;
  margin: 24px 0 0;
}
.detail-grid dt { font-size: 0.75rem; color: var(--color-text-muted); letter-spacing: 0.04em; text-transform: uppercase; }
.detail-grid dd { margin: 4px 0 0; font-weight: 700; color: var(--color-text); overflow-wrap: anywhere; }

.review-comments { white-space: pre-line; background: var(--color-bg); border-radius: var(--radius-input); padding: 14px 16px; }
.reject-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.receipt-file { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; font-weight: 600; overflow-wrap: anywhere; }
.receipt-preview { display: block; max-width: 100%; border: 1px solid var(--color-border); border-radius: 10px; background: #fff; }
.receipt-pdf { width: 100%; height: 640px; }

@media (max-width: 760px) {
  .requests-card .account-header { flex-wrap: wrap; }
  .requests-create, .requests-card .account-header .btn-ghost { margin-left: 0; }
  .table-wrap { border: none; overflow: visible; }
  .requests-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .requests-table tr { display: block; border: 1px solid var(--color-border); border-radius: 10px; margin-bottom: 12px; padding: 6px 0; }
  .requests-table td { display: flex; justify-content: space-between; gap: 12px; border: none; padding: 8px 14px; }
  .requests-table td::before { content: attr(data-label); color: var(--color-text-muted); font-size: 0.8rem; }
  .requests-table .num { text-align: right; }
  .receipt-pdf { height: 420px; }
}

/* ---------- Aviso de espera (consultas al ERP) ---------- */

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(22, 32, 43, 0.45);
}
.loading-overlay[hidden] { display: none; }
.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 340px;
  padding: 28px 32px;
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.2);
  text-align: center;
}
.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 5px solid #d6e6fb;
  border-top-color: var(--color-action);
  animation: spin 0.8s linear infinite;
}
.loading-message { color: var(--color-navy); font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Con movimiento reducido el anillo queda fijo; el mensaje sigue visible. */
