* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background-color: #0f172a;
  color: #e5e7eb;
}

.app-header {
  padding: 1.5rem;
  background-color: #020617;
  border-bottom: 1px solid #1e293b;
}

.app-header h1 {
  margin: 0;
  font-size: 1.4rem;
}

.app-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
}

.app-main {
  padding: 1.5rem;
  max-width: 480px;
  margin: 0 auto;
}

.card {
  background-color: #020617;
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}

input {
  width: 100%;
  padding: 0.6rem;
  margin-top: 0.5rem;
  border-radius: 8px;
  border: none;
  outline: none;
}

button {
  width: 100%;
  margin-top: 0.8rem;
  padding: 0.6rem;
  border-radius: 8px;
  border: none;
  background-color: #dc2626;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background-color: #b91c1c;
}

.hidden {
  display: none;
}
.sub-card {
  padding: 0.8rem;
  border-radius: 10px;
  margin-bottom: 0.8rem;
  background: #020617;
  border-left: 5px solid #475569;
}

.sub-card.activa {
  border-left-color: #22c55e;
}

.sub-card.vencida {
  border-left-color: #ef4444;
}

.sub-card.suspendida {
  border-left-color: #facc15;
}

.sub-title {
  font-weight: bold;
  margin-bottom: 0.3rem;
}
.sub-actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.4rem;
}

.sub-actions button {
  flex: 1;
  padding: 0.4rem;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
}

.btn-edit {
  background: #2563eb;
  color: white;
}

.btn-renew {
  background: #16a34a;
  color: white;
}

.btn-cancel {
  background: #dc2626;
  color: white;
}
/* =========================
   MODAL (VERSIÓN LIMPIA)
========================= */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-box {
  background: #020617;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;

  padding: 1rem;
  border-radius: 10px;

  overflow-y: auto; /* scroll vertical */
  overflow-x: visible; /* 🔥 CLAVE: permite dropdown */
}

/* inputs generales */
.modal-box input,
.modal-box select {
  width: 100%;
  box-sizing: border-box;
}

/* títulos */
.modal-box h3 {
  margin-bottom: 0.6rem;
}

/* inputs */
.modal-box input {
  padding: 0.4rem;
  margin-bottom: 0.6rem;
}

/* acciones */
.modal-actions {
  display: flex;
  gap: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.6rem;
}

.acciones-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.6rem; /* menos espacio abajo */
}

.btn-action {
  padding: 0.65rem; /* antes más grande */
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.8rem; /* texto más compacto */
}

/* Colores */
.btn-action.blue {
  background: #2563eb;
}
.btn-action.purple {
  background: #7c3aed;
}
.btn-action.green {
  background: #10b981;
}
.btn-action.orange {
  background: #f59e0b;
}
.btn-action.violet {
  background: #8b5cf6;
}
.modal-box input:disabled {
  background-color: #1f2937; /* gris oscuro elegante */
  color: #ffffff; /* texto blanco */
  opacity: 1; /* evita que se vea “apagado” */
  font-weight: 600;
}
/* =========================
   SPINNER (UX PRO)
========================= */

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Botón en estado loading */
.btn-loading {
  display: flex; /* 🔥 NO inline-flex */
  align-items: center;
  justify-content: center;

  gap: 0.5rem;

  padding: 0.6rem !important; /* 🔥 fuerza mismo padding */
  min-height: 40px; /* 🔥 evita salto */
  line-height: 1;

  opacity: 0.85;
  cursor: not-allowed;
}

/* =========================
   TOAST MODERNO
========================= */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #020617;
  color: #fff;
  padding: 0.8rem 1.2rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 9999;

  opacity: 0;
  pointer-events: none;

  transition: all 0.3s ease;
}

/* visible */
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* colores */
.toast.success {
  border-left: 4px solid #22c55e;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

.toast.warning {
  border-left: 4px solid #f59e0b;
}

/* === UNIFICAR INPUTS Y SELECTS (MÓVIL FIX) === */

.modal-box input,
.modal-box select {
  width: 100%;
  height: 44px; /* 🔥 MISMA ALTURA */
  padding: 0 12px;
  font-size: 16px; /* 🔥 MISMO TEXTO */
  border-radius: 10px;
  border: none;
  box-sizing: border-box;
}

/* Quita estilos raros de Android */
.modal-box select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #ffffff;
  color: #000000;
}

/* Flechita custom (opcional, pero elegante) */
.modal-box select {
  background-image: url("data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}
.dropdown {
  position: relative;
}

.dropdown input {
  width: 100%;
}

.dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  z-index: 9999;
}

.dropdown-list div {
  padding: 0.6rem;
  cursor: pointer;
}

.dropdown-list div:hover {
  background: #1f2937;
}

.hidden {
  display: none;
}

/* =========================
   TABLA VENCIMIENTOS – CENTRADA
========================= */

.tabla-vencimientos {
  overflow-x: auto;
}

/* tabla estilo Excel */
.tabla-vencimientos table {
  border-collapse: collapse;
  min-width: 100%;
  width: max-content;
  table-layout: auto;
}

/* encabezados */
.tabla-vencimientos thead th {
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.6rem 0.8rem;
  white-space: nowrap;
}

/* datos centrados */
.tabla-vencimientos tbody td {
  text-align: center; /* 🔥 AQUÍ ESTÁ LA CLAVE */
  font-size: 0.85rem;
  padding: 0.6rem 0.8rem;
  white-space: nowrap;
}
/* FORZAR TODO CENTRADO */
.tabla-vencimientos tbody td {
  text-align: center !important;
}
/* =========================
   TABLA CON LÍNEAS
========================= */

.tabla-vencimientos table {
  border-collapse: collapse; /* 🔥 clave */
}

/* líneas en todas las celdas */
.tabla-vencimientos th,
.tabla-vencimientos td {
  border: 1px solid #334155; /* gris elegante */
}
/* =========================
   ENCABEZADO DESTACADO
========================= */

.tabla-vencimientos thead {
  background-color: #1e293b; /* gris oscuro elegante */
}

.tabla-vencimientos thead th {
  color: #ffffff;
  font-weight: 700;
  border-bottom: 2px solid #475569;
}
/* =========================
   COLORES ESTADO
========================= */

.estado {
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
}

/* vencida */
.estado.VENCIDA {
  color: #ef4444;
}

/* por vencer */
.estado.POR_VENCER {
  color: #facc15;
}

/* activa */
.estado.ACTIVA {
  color: #22c55e;
}

/* suspendida */
.estado.SUSPENDIDA {
  color: #a855f7;
}
.autocomplete-list {
  background: #0f172a;
  border: 1px solid #334155;
  max-height: 200px;
  overflow-y: auto;
  border-radius: 6px;
  margin-top: 4px;
  position: relative;
  z-index: 5;
}

.autocomplete-item {
  padding: 0.5rem;
  cursor: pointer;
}

.autocomplete-item:hover {
  background-color: #1e293b;
}
