/* ============================================================
   AuraPay — domain components layered on Metronic.
   Loaded AFTER styles.css and aura-admin.css. Only defines the
   pieces Metronic doesn't ship: status pills, the traceability
   timeline and the monospace helper for official numbers.
   Institutional identity (verde Gobernación + oro) comes from
   aura-admin.css. UI copy is Spanish; comments English.
   ============================================================ */

/* Monospace for reference data: official numbers, PINs, dates, money */
.mono {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  letter-spacing: -.01em;
}

/* ---- Status pills: one vocabulary across the app ---------------------- */
.status {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .72rem; font-weight: 600; line-height: 1.5;
  padding: .12rem .55rem; border-radius: 9999px; white-space: nowrap;
  border: 1px solid transparent;
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Workflow states: borrador | presentado | aprobado | rechazado | pagado | anulado */
.status-borrador   { color:#475569; background:#f1f5f9; border-color:#e2e8f0; }
.status-presentado { color:#1d4ed8; background:#e6edff; border-color:#d3e0ff; }
.status-aprobado   { color:#15803d; background:#dcfce7; border-color:#c5f3d3; }
.status-rechazado  { color:#b91c1c; background:#fee2e2; border-color:#fbcfcf; }
.status-pagado     { color:#0f766e; background:#cff6ef; border-color:#b5efe4; }
.status-anulado    { color:#6b7280; background:#f3f4f6; border-color:#e5e7eb; }
/* Lifecycle states: activo | suspendido | terminado | liquidado */
.status-activo     { color:#15803d; background:#dcfce7; border-color:#c5f3d3; }
.status-suspendido { color:#b45309; background:#fef3c7; border-color:#fce9b0; }
.status-terminado  { color:#475569; background:#f1f5f9; border-color:#e2e8f0; }
.status-liquidado  { color:#6d28d9; background:#ede9fe; border-color:#ddd4fb; }

/* Dark theme: translucent tints so pills read on the dark surface */
.dark .status-borrador,
.dark .status-terminado { color:#cbd5e1; background:rgba(148,163,184,.14); border-color:rgba(148,163,184,.22); }
.dark .status-presentado { color:#93b4ff; background:rgba(59,130,246,.16); border-color:rgba(59,130,246,.28); }
.dark .status-aprobado,
.dark .status-activo    { color:#86efac; background:rgba(34,197,94,.15); border-color:rgba(34,197,94,.28); }
.dark .status-rechazado { color:#fca5a5; background:rgba(239,68,68,.16); border-color:rgba(239,68,68,.30); }
.dark .status-pagado    { color:#5eead4; background:rgba(20,184,166,.16); border-color:rgba(20,184,166,.30); }
.dark .status-anulado   { color:#9ca3af; background:rgba(156,163,175,.14); border-color:rgba(156,163,175,.22); }
.dark .status-suspendido{ color:#fcd34d; background:rgba(245,158,11,.16); border-color:rgba(245,158,11,.30); }
.dark .status-liquidado { color:#c4b5fd; background:rgba(139,92,246,.16); border-color:rgba(139,92,246,.30); }

/* ---- Traceability timeline (audit / event log) ----------------------- */
.timeline-item {
  position: relative; padding: 0 0 1.15rem 1.2rem;
  border-left: 2px solid var(--border);
}
.timeline-item:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline-item::before {
  content: ''; position: absolute; left: -7px; top: 3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--background); border: 2px solid var(--primary);
}

/* Clickable table rows keep the pointer affordance */
tr.row-link { cursor: pointer; }

/* ---- Explicit sizes -------------------------------------------------- */
/* The Metronic styles.css is a PRECOMPILED Tailwind bundle: arbitrary
   utilities (e.g. max-h-[54px], z-[1080]) only exist if Metronic's own
   source used them. These helpers cover the values we need but the bundle
   lacks, so they can't silently no-op. */
#toast-area { z-index: 1080; }
.ct-logo-lg { height: 52px; width: auto; }
.ct-logo-md { height: 44px; width: auto; }
.ct-logo-sm { height: 28px; width: auto; }
.ct-w-login { max-width: 400px; }
.ct-w-modal { max-width: 520px; }
.ct-w-modal-sm { max-width: 460px; }
.ct-w-modal-md { max-width: 600px; }
/* Formulario de una sola columna: centrado y con ancho de lectura cómodo
   en pantallas grandes. */
.ct-w-form { max-width: 780px; margin-inline: auto; }
/* Grillas de formulario: el bundle precompilado NO trae md:grid-cols-3 ni
   md:col-span-2 (solo md:grid-cols-2 y lg:col-span-*), así que esas clases
   Tailwind no aplican. Estas son el equivalente en CSS real. */
@media (min-width: 768px) {
  .ct-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ct-span-2 { grid-column: span 2 / span 2; }
}
/* Grillas: 'ct-span-full' ocupa toda la fila sea cual sea el número de
   columnas del breakpoint (el bundle no trae sm:col-span-* ni lg:grid-cols-6,
   así que esas clases Tailwind NO aplican). */
.ct-span-full { grid-column: 1 / -1; }
.ct-self-start { justify-self: start; }
/* Avisos: el bundle no define .text-warning ni .text-success (solo
   .text-destructive), pero sí los tokens de color de la paleta. */
.ct-text-warn { color: var(--color-yellow-700, #a16207); }
.ct-text-ok   { color: var(--color-green-700, #15803d); }
.dark .ct-text-warn { color: var(--color-yellow-400, #facc15); }
.dark .ct-text-ok   { color: var(--color-green-500, #22c55e); }
/* Barra de progreso global (cualquier fetch la activa) */
#ct-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0;
  z-index: 2000; background: var(--color-green-600, #16a34a);
  box-shadow: 0 0 8px var(--color-green-600, #16a34a);
  transition: width .25s ease, opacity .3s ease; opacity: 0; }
#ct-progress.on { opacity: 1; }
/* Botón en estado "ocupado": deshabilitado + spinner */
.kt-btn[data-busy] { pointer-events: none; opacity: .65; }
.kt-btn[data-busy]::after { content: ''; width: 13px; height: 13px;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 9999px;
  display: inline-block; margin-left: 7px; vertical-align: -2px;
  animation: ct-spin .7s linear infinite; }
/* Fila de tabla clicable (el bundle no trae hover:bg-muted/40 ni hover:underline) */
.ct-row-link { cursor: pointer; }
.ct-row-link:hover { background: var(--muted); }
.ct-link:hover { text-decoration: underline; }
/* Spinner (Metronic precompiled no trae un spinner utilitario) */
.ct-spinner { width: 40px; height: 40px; border-radius: 9999px;
  border: 3px solid var(--border); border-top-color: var(--color-green-600, #16a34a);
  animation: ct-spin .7s linear infinite; }
@keyframes ct-spin { to { transform: rotate(360deg); } }
.ct-goldbar { display: inline-block; width: 14px; height: 2px; background: var(--aura-gold); }
/* Divider rows whose last item drops its border (last:border-0 not in bundle) */
.ct-rows > * { border-bottom: 1px solid var(--border); }
.ct-rows > *:last-child { border-bottom: 0; }

/* ---- Tabs (vistas de detalle) ---------------------------------------- */
.ct-tab {
  padding: .55rem 1rem; font-size: .875rem; font-weight: 600;
  color: var(--secondary-foreground); border-bottom: 2px solid transparent;
  white-space: nowrap; background: none; cursor: pointer;
}
.ct-tab:hover { color: var(--foreground); }
.ct-tab-active { color: var(--primary); border-bottom-color: var(--primary); }

/* Search dropdown (lookup de usuarios/terceros) */
.ct-search-menu { max-height: 220px; overflow: auto; }

/* Fade-in for toasts / injected nodes */
@keyframes ct-fade { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.ct-fade { animation: ct-fade .18s ease both; }

/* ============================================================
   PORTAL PÚBLICO (ciudadanos / notarías / otras entidades)
   Shell sin sidebar, wizard por pasos y el combo con búsqueda.
   ============================================================ */

/* Bordes de aviso: el bundle no define .border-success/.border-destructive
   como utilidades, así que van como CSS real. */
.ct-border-ok   { border-color: var(--color-green-600, #16a34a) !important; }
.ct-border-err  { border-color: var(--color-red-600, #dc2626) !important; }
.ct-min-240     { min-width: 240px; }

/* ---- Pestañas de la landing (Crear / Verificar) ---------------------- */
.ct-ptab {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.25rem; font-size: .9rem; font-weight: 600;
  color: var(--secondary-foreground); background: var(--muted);
  border: 1px solid var(--border); border-bottom: 0;
  border-radius: .5rem .5rem 0 0; cursor: pointer; white-space: nowrap;
}
.ct-ptab:hover { color: var(--foreground); }
.ct-ptab-active {
  color: var(--primary); background: var(--background);
  border-color: var(--border); position: relative; z-index: 1;
}

/* ---- Wizard por pasos ------------------------------------------------ */
.ct-steps { display: flex; flex-wrap: wrap; gap: .5rem; }
.ct-step {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .9rem; font-size: .85rem; font-weight: 600;
  border: 1px solid var(--border); border-radius: .5rem;
  color: var(--secondary-foreground); background: var(--background); cursor: pointer;
}
.ct-step-num {
  width: 22px; height: 22px; border-radius: 9999px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .72rem; background: var(--muted); color: var(--secondary-foreground);
}
.ct-step-active { color: var(--primary); border-color: var(--primary); }
.ct-step-active .ct-step-num { background: var(--primary); color: #fff; }
.ct-step-done .ct-step-num { background: var(--color-green-600, #16a34a); color: #fff; }
.ct-pane { display: none; }
.ct-pane-active { display: block; }

/* ---- Combo con búsqueda (ctCombo) ----------------------------------- */
.ct-combo { position: relative; }
.ct-combo-menu {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 2px);
  max-height: 260px; overflow-y: auto;
  background: var(--background); border: 1px solid var(--border);
  border-radius: .5rem; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.ct-combo-item {
  padding: .5rem .7rem; font-size: .85rem; cursor: pointer;
  border-bottom: 1px solid var(--border); line-height: 1.35;
}
.ct-combo-item:last-child { border-bottom: 0; }
.ct-combo-active, .ct-combo-item:hover { background: var(--muted); }
.ct-combo-empty { padding: .6rem .7rem; font-size: .82rem; color: var(--secondary-foreground); }

/* ---- Recibo imprimible ---------------------------------------------- */
.ct-pin {
  font-family: var(--font-mono, ui-monospace, Menlo, monospace);
  font-size: 1.5rem; font-weight: 700; letter-spacing: .12em;
}
@media print {
  .ct-no-print { display: none !important; }
  body { background: #fff; }
  .ct-recibo { border: 0 !important; box-shadow: none !important; }
}

.ct-shadow { box-shadow: 0 8px 24px rgba(0,0,0,.12); }
/* El bundle no trae rounded-tl-none ni las variantes de opacidad bg-primary/10 */
.ct-rounded-tl0 { border-top-left-radius: 0; }
.ct-tint-primary {
  background: #eaf3ec;                                        /* fallback */
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}
.dark .ct-tint-primary { background: rgba(255,255,255,.06);
  background: color-mix(in srgb, var(--primary) 22%, transparent); }

/* ============================================================
   UTILIDADES QUE EL BUNDLE PRECOMPILADO NO TRAE
   Metronic compiló Tailwind solo con las clases que su propio
   código usa, así que estas no existen y no aplican en silencio.
   Se definen aquí con la semántica exacta de Tailwind para que
   las plantillas (incluidas base/login/dashboard, que ya las
   usaban sin efecto) se rendericen como se escribieron.
   Verificar con: python3.10 tools/check_css.py
   ============================================================ */
.object-contain { object-fit: contain; }
.font-bold      { font-weight: 700; }
.leading-tight  { line-height: 1.25; }
.p-6            { padding: 1.5rem; }
.py-6           { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.px-6           { padding-left: 1.5rem; padding-right: 1.5rem; }
.z-\[1080\]     { z-index: 1080; }
.text-danger    { color: var(--destructive); }
.text-info      { color: var(--color-blue-600, #2563eb); }
.border-primary\/60 { border-color: color-mix(in srgb, var(--primary) 60%, transparent); }
.bg-info\/10    { background: color-mix(in srgb, var(--color-blue-600, #2563eb) 10%, transparent); }
.bg-success\/10 { background: color-mix(in srgb, var(--color-green-600, #16a34a) 10%, transparent); }
/* Grids que faltaban en el bundle. `lg:grid-cols-6` la usa admin_auditoria.html
   desde antes: sin esto su fila de filtros se apila en una sola columna. */
@media (min-width: 1024px) {
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.mt-0\.5 { margin-top: .125rem; }
.gap-x-5 { column-gap: 1.25rem; }
.gap-y-3 { row-gap: .75rem; }
.gap-0\.5 { gap: .125rem; }
.gap-y-2 { row-gap: .5rem; }

/* ============================================================
   AuraPay — pagos. Todo lo de abajo son clases que el bundle
   PRECOMPILADO de Metronic no trae: si se usaran sin definirlas
   aquí no aplicarían y el layout saldría mal EN SILENCIO.
   Verificado con `python3.10 tools/check_css.py`.
   ============================================================ */

/* ---- Pastillas de estado del cobro ----------------------------------- */
/* Vocabulario único: CREADO/PENDIENTE (warn), PAGADO (ok), ERROR (bad),
   VENCIDO/ANULADO (muted). Se usan en la bandeja, el detalle y la
   conciliación, para que el mismo estado se vea igual en todas partes. */
.ct-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .72rem; font-weight: 600; line-height: 1.5;
  padding: .12rem .55rem; border-radius: 9999px; white-space: nowrap;
  border: 1px solid transparent;
}
.ct-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ct-pill-ok    { color:#15803d; background:#dcfce7; border-color:#c5f3d3; }
.ct-pill-warn  { color:#b45309; background:#fef3c7; border-color:#fce9b0; }
.ct-pill-bad   { color:#b91c1c; background:#fee2e2; border-color:#fbcfcf; }
.ct-pill-muted { color:#475569; background:#f1f5f9; border-color:#e2e8f0; }
.dark .ct-pill-ok    { color:#86efac; background:rgba(34,197,94,.15);  border-color:rgba(34,197,94,.28); }
.dark .ct-pill-warn  { color:#fcd34d; background:rgba(245,158,11,.16); border-color:rgba(245,158,11,.30); }
.dark .ct-pill-bad   { color:#fca5a5; background:rgba(239,68,68,.16);  border-color:rgba(239,68,68,.30); }
.dark .ct-pill-muted { color:#cbd5e1; background:rgba(148,163,184,.14);border-color:rgba(148,163,184,.22); }

/* ---- Bitácora del cobro ---------------------------------------------- */
.ct-timeline { display: flex; flex-direction: column; }
.ct-timeline-item {
  position: relative; padding: 0 0 1.15rem 1.2rem;
  border-left: 2px solid var(--border);
}
.ct-timeline-item:last-child { padding-bottom: 0; border-left-color: transparent; }
.ct-timeline-item::before {
  content: ''; position: absolute; left: -7px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--background); border: 2px solid var(--primary);
}

/* ---- Tipografía de datos de referencia -------------------------------- */
/* Referencias de recaudo, identificadores del banco, montos: en monoespaciada
   se comparan de un vistazo y no se confunde un 0 con una O. */
.font-mono { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); }
.tracking-wider { letter-spacing: .05em; }
.tracking-\[0\.15em\] { letter-spacing: .15em; }
/* La referencia y las URL de webhook son largas y sin espacios: sin esto
   desbordan la tarjeta en pantallas angostas. */
.break-all { word-break: break-all; }

/* ---- Anchos que el bundle no trae ------------------------------------ */
.max-w-\[90px\]  { max-width: 90px; }
.max-w-\[140px\] { max-width: 140px; }
.max-w-\[160px\] { max-width: 160px; }
.max-w-\[240px\] { max-width: 240px; }
.max-w-\[320px\] { max-width: 320px; }
.max-w-\[480px\] { max-width: 480px; }
.max-w-\[520px\] { max-width: 520px; }
.max-w-\[560px\] { max-width: 560px; }
.max-w-\[620px\] { max-width: 620px; }
.max-w-\[680px\] { max-width: 680px; }
.max-w-\[880px\] { max-width: 880px; }

/* Bordes de tarjeta con opacidad: el bundle solo trae los que Metronic usó. */
.border-success\/50     { border-color: color-mix(in srgb, var(--success, #16a34a) 50%, transparent); }
.border-destructive\/40 { border-color: color-mix(in srgb, var(--destructive, #dc2626) 40%, transparent); }
