  /* Fuente global */
  * {
    font-family: 'Open Sans', Arial, sans-serif;
  }

  /* Layout de 2 columnas */
  .contenedor-principal {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 100%;
    margin: 0 auto;
  }

  .columna {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  /* Formulario columna */
  .formulario-columna {
    background-color: white;
  }

  /* Tabla columna */
  .tabla-columna {
    background-color: white;
    overflow-x: auto;
  }

  /* Estilos del header */
  .headerh2 {
    background-color: #1f5a8f;
    color: white;
    padding: 15px;
    /* margin: -20px -20px 20px -20px; */
    border-radius: 8px 8px 0 0;
    text-align: center;
  }

  .headerh2 h2 {
    margin: 0;
    font-size: 18px;
  }



  .header {
    background-color: #1f5a8f;
    color: white;
    padding: 15px;
    margin: -20px -20px 20px -20px;
    border-radius: 8px 8px 0 0;
    text-align: center;
  }

  .header h2 {
    margin: 0;
    font-size: 18px;
  }

  .tituloscarga {
    color: #c2c2c2;
    /* font-family: cursive; */
  }

  /* Fila de campos en línea */
  .fila-campos {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    /* margin-bottom: 15px; */
  }

  .fila-campos .control {
    margin-bottom: 0;
  }

  /* Tipo Crédito ocupa 2 columnas */
  .fila-campos .control:has(#periodo) {
    grid-column: span 2;
  }

  /* Estilos de controles */
  .control {
    /* margin-bottom: 15px; */
  }

  .control label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    color: #9f9f9f;
    font-size: 12px;
  }

  .control input,
  .control select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    box-sizing: border-box;
    text-align: center;
    height: 40px;
    line-height: 20px;
  }

  .control input:focus,
  .control select:focus {
    outline: none;
    border-color: #1f5a8f;
    box-shadow: 0 0 5px rgba(31, 90, 143, 0.3);
  }

  /* Radios */
  .radios {
    display: flex;
    gap: 50%;
    margin: 10px 0;
    justify-content: center;
  }

  .radioContenedor {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
    margin-bottom: 0;
  }

  .radioContenedor input[type="radio"] {
    width: auto;
    margin: 0;
    cursor: pointer;
  }

  .circle {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #1f5a8f;
    border-radius: 50%;
  }

  .radioContenedor input[type="radio"]:checked+.circle {
    background-color: #1f5a8f;
  }

  /* Botones */
  .botones {
    display: flex;
    gap: 10px;
    /* margin-top: 20px; */
  }

  .btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
  }

  .btn-primary {
    background-color: #1f5a8f;
    color: white;
  }

  .btn-primary:hover {
    background-color: #164577;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }

  .btn-secondary {
    background-color: #5a7a8f;
    color: white;
  }

  .btn-secondary:hover {
    background-color: #475e6e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }

  .btn-success {
    background-color: #bcda03;
    color: white;
  }

  .btn-success:hover {
    background-color: #a8c303;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }

  .btn-danger {
    background-color: #dc3545;
    color: white;
  }

  .btn-danger:hover {
    background-color: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }

  /* Tabla */
  table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
  }

  table thead {
    background-color: #1f5a8f;
    color: white;
  }

  table thead td {
    padding: 12px;
    font-weight: 600;
    text-align: center;
    border: 1px solid #ddd;
  }

  table tbody tr:hover {
    background-color: #f0f0f0;
  }

  table tbody td {
    padding: 10px;
    text-align: right;
    border: 1px solid #ddd;
  }

  table tbody td:first-child {
    text-align: center;
    font-weight: 600;
  }

  /* Mandas a cerrar la tabla de amortizcion */

  .tabla-columna {
    background-color: white;
    overflow-x: auto;
    display: none;
    /* Ocultar inicialmente */
  }

  .tabla-columna.mostrar {
    display: block;
    max-height: 500px;
    /* el alto que quieras */
    overflow-y: auto;
    /* scroll vertical */
    overflow-x: auto;
    /* scroll horizontal en móviles */
    /* Mostrar cuando tenga esta clase */
  }


  .control select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    box-sizing: border-box;
    background-color: white;
    cursor: pointer;
    height: 40px;
    text-align: center;
  }

  /* Forzar estilos iguales en todos los inputs */
  #plazo,
  #monto,
  #interes {
    height: 40px !important;
    padding: 10px !important;
    border-radius: 4px !important;
    border: 1px solid #ddd !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
    appearance: none !important;
  }

  .control select option {
    padding: 2px 8px;
    background-color: white;
    color: #333;
    font-size: 18px;
    line-height: 1.2;
  }

  .control select option:hover,
  .control select option:checked {
    background-color: #1f5a8f;
    color: white;
  }

  .control select optgroup {
    font-weight: bold;
    color: #1f5a8f;
  }

  #tipo {
    text-align: center;
    color: #9f9f9f;
  }

  #tipo option {
    text-align: left;
    color: #9f9f9f;
  }

  #tipo optgroup {
    text-align: left;
  }

  /* Tipo Crédito ocupa 2 columnas */
  /* .fila-campos .control:has(#tipo) {
    flex: 2;
  } */




  /* Select de tipo de crédito centrado y gris */
  #periodo {
    text-align: center;
    color: #9f9f9f;
  }

  #periodo option {
    text-align: left;
    color: #9f9f9f;
  }

  #periodo optgroup {
    text-align: left;
  }


  .radioContenedor input[type="radio"] {
    display: none;
    /* Ocultar el radio nativo */
  }

  .circle {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #1f5a8f;
    border-radius: 50%;
    background-color: white;
  }

  .radioContenedor input[type="radio"]:checked+.circle {
    background-color: #1f5a8f;
  }

  /* Tabla mejorada */
  #amortizaciones {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* -margin-top: 15px; */
  }

  /* Scroll horizontal suave en móviles */
  .tabla-columna {
    -webkit-overflow-scrolling: touch;
  }

  table {
    width: 100%;
    min-width: 500px;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  table thead {
    background: linear-gradient(135deg, #1f5a8f 0%, #2a6ba8 100%);
    color: white;
  }

  table thead td {
    padding: 15px 10px;
    font-weight: 600;
    text-align: center;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
  }

  table tbody tr {
    border-bottom: 1px solid #e8e8e8;
    transition: background-color 0.2s ease;
  }

  table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
  }

  table tbody tr:hover {
    background-color: #e3f2fd;
  }

  table tbody td {
    padding: 12px 10px;
    text-align: right;
    border: none;
    font-size: 18px;
    color: #b7b7b7;
  }

  table tbody td:first-child {
    text-align: center;
    font-weight: 600;
    color: #1f5a8f;
  }

  table tbody td:nth-child(2) {
    text-align: center;
    color: #7b9d1f;
  }

  .fila-totales {
    background-color: #1f5a8f !important;
    color: white !important;
    font-weight: bold;
  }

  .fila-totales td {
    color: white !important;
    font-weight: bold !important;
    padding: 15px 10px !important;
  }

  #tablaDetalle {
    margin-bottom: 30px;
    min-width: 450px;
  }

  #tablaDetalle thead td {
    font-size: 13px;
  }

  #tablaDetalle tbody td {
    font-size: 12px;
  }

  #tablaDetalle tbody td:first-child {
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
  }

  #tablaDetalle tbody td:last-child {
    text-align: left;
    font-size: 11px;
    line-height: 1.4;
  }

  .fila-total {
    background-color: #e8f4f8 !important;
    font-weight: bold;
  }

  .fila-cuota {
    background-color: #daff76 !important;
  }

  /* Responsive tablaDetalle */
  @media (max-width: 768px) {
    #tablaDetalle {
      min-width: 400px;
    }

    #tablaDetalle thead td {
      font-size: 11px;
      padding: 8px 5px;
    }

    #tablaDetalle tbody td {
      font-size: 11px;
      padding: 8px 5px;
    }

    #tablaDetalle tbody td:last-child {
      font-size: 10px;
    }
  }

  @media (max-width: 480px) {
    #tablaDetalle {
      min-width: 350px;
    }

    #tablaDetalle thead td {
      font-size: 10px;
      padding: 6px 4px;
    }

    #tablaDetalle tbody td {
      font-size: 10px;
      padding: 6px 4px;
    }

    #tablaDetalle tbody td:last-child {
      font-size: 9px;
    }
  }

  /* Modal personalizado */
  .modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
  }

  .modal-overlay.mostrar {
    display: flex;
  }

  .modal-contenido {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    overflow: hidden;
  }

  .modal-header {
    background-color: #1f5a8f;
    color: white;
    padding: 15px 20px;
  }

  .modal-header h3 {
    margin: 0;
    font-size: 18px;
  }

  .modal-body {
    padding: 20px;
    text-align: center;
  }

  .modal-body p {
    margin: 0;
    font-size: 18px;
    color: #333;
  }

  .modal-footer {
    padding: 15px 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
    border-top: 1px solid #eee;
  }

  .modal-footer .btn {
    min-width: 100px;
  }

  /* Modal de alerta (error) */
  .modal-header-alerta {
    background-color: #dc3545;
  }

  /* ===================== RESPONSIVE PARA MÓVILES ===================== */

  /* Tablets grandes */
  @media (max-width: 1024px) {
    .contenedor-principal {
      padding: 15px;
      max-width: 100%;
    }

    .fila-campos {
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }

    .fila-campos .control:has(#periodo) {
      grid-column: span 2;
    }
  }

  /* Tablets y móviles grandes */
  @media (max-width: 768px) {
    .contenedor-principal {
      padding: 10px;
      max-width: 100%;
    }

    .columna {
      padding: 15px;
    }

    .header {
      margin: -15px -15px 15px -15px;
      padding: 12px;
    }

    .header h2 {
      font-size: 16px;
    }

    /* Filas de campos en 1 columna */
    .fila-campos {
      grid-template-columns: 1fr;
      gap: 10px;
    }

    /* Tipo Crédito ocupa 1 columna en móvil */
    .fila-campos .control:has(#periodo) {
      grid-column: span 1;
    }

    .control label {
      font-size: 12px;
    }

    .control input,
    .control select {
      font-size: 14px;
      height: 42px;
      padding: 10px;
    }

    /* Radios en fila */
    .radios {
      gap: 30px;
      flex-wrap: wrap;
      justify-content: center;
    }

    .radioContenedor {
      font-size: 14px;
    }

    /* Botones */
    .botones {
      flex-direction: column;
      gap: 10px;
    }

    .btn {
      padding: 12px 15px;
      font-size: 14px;
      width: 100%;
    }

    /* Tablas */
    table {
      font-size: 12px;
    }

    table thead td {
      padding: 10px 5px;
      font-size: 11px;
      letter-spacing: 0;
    }

    table tbody td {
      padding: 8px 5px;
      font-size: 12px;
    }

    .headerh2 {
      padding: 10px;
    }

    .headerh2 h2 {
      font-size: 16px;
    }

    /* Modal */
    .modal-contenido {
      width: 95%;
      margin: 10px;
    }

    .modal-header {
      padding: 12px 15px;
    }

    .modal-header h3 {
      font-size: 16px;
    }

    .modal-body {
      padding: 15px;
    }

    .modal-body p {
      font-size: 14px;
    }

    .modal-footer {
      padding: 12px 15px;
      flex-direction: column;
    }

    .modal-footer .btn {
      width: 100%;
      min-width: auto;
    }

    .fila-totales td {
      font-size: 12px !important;
    }
  }

  /* Móviles pequeños */
  @media (max-width: 480px) {
    .contenedor-principal {
      padding: 8px;
    }

    .columna {
      padding: 12px;
      border-radius: 6px;
    }

    .header {
      margin: -12px -12px 12px -12px;
      padding: 10px;
      border-radius: 6px 6px 0 0;
    }

    .header h2 {
      font-size: 14px;
    }

    .fila-campos {
      gap: 8px;
    }

    .control label {
      font-size: 11px;
      margin-bottom: 4px;
    }

    .control input,
    .control select {
      font-size: 14px;
      height: 40px;
      padding: 8px;
    }

    #plazo,
    #monto,
    #interes {
      height: 40px !important;
      padding: 8px !important;
    }

    .radios {
      gap: 20px;
      margin: 10px 0;
    }

    .radioContenedor {
      font-size: 13px;
      gap: 6px;
    }

    .circle {
      width: 18px;
      height: 18px;
    }

    .btn {
      padding: 12px;
      font-size: 14px;
    }

    /* Tablas más compactas */
    table thead td {
      padding: 8px 4px;
      font-size: 10px;
      letter-spacing: 0;
      text-transform: none;
    }

    table tbody td {
      padding: 6px 4px;
      font-size: 11px;
    }

    .fila-totales td {
      padding: 8px 4px !important;
      font-size: 11px !important;
    }

    #tablaDetalle tbody td {
      font-size: 11px;
    }

    .headerh2 {
      padding: 10px;
      border-radius: 6px 6px 0 0;
    }

    .headerh2 h2 {
      font-size: 14px;
    }

    /* Tabla de datos entrada */
    #tablaDatosEntrada thead td,
    #tablaDatosEntrada tbody td {
      padding: 6px 4px;
      font-size: 11px;
    }

    /* Loading */
    .logo-latido {
      width: 100px;
    }

    .texto-cargando {
      font-size: 14px;
    }
  }

  /* Móviles muy pequeños */
  @media (max-width: 360px) {
    .contenedor-principal {
      padding: 5px;
    }

    .columna {
      padding: 10px;
    }

    .header {
      margin: -10px -10px 10px -10px;
      padding: 8px;
    }

    .header h2 {
      font-size: 13px;
    }

    .control label {
      font-size: 10px;
    }

    .control input,
    .control select {
      font-size: 13px;
      height: 38px;
    }

    .btn {
      padding: 10px;
      font-size: 13px;
    }

    table thead td {
      padding: 6px 2px;
      font-size: 9px;
    }

    table tbody td {
      padding: 5px 2px;
      font-size: 10px;
    }

    .headerh2 h2 {
      font-size: 13px;
    }
  }

  /* Tabla de datos de entrada con efecto cortina */
  .tabla-cortina {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    animation: cortina 0.8s ease-out forwards;
  }

  @keyframes cortina {
    0% {
      max-height: 0;
      opacity: 0;
    }

    100% {
      max-height: 200px;
      opacity: 1;
    }
  }

  #tablaDatosEntrada {
    margin-bottom: 20px;
    min-width: 400px;
  }

  #tablaDatosEntrada thead {
    background: #daff76;
    color: #7fa026;
  }

  #tablaDatosEntrada thead td {
    padding: 12px 8px;
    font-weight: 600;
    text-align: center;
    font-size: 14px;
    text-transform: uppercase;
    color: #1f5a8f;
    white-space: nowrap;
  }

  #tablaDatosEntrada tbody td {
    padding: 12px 8px;
    text-align: center;
    font-weight: 500;
    background-color: #f4ffdb;
    color: #7fa026;
    font-size: 13px;
  }

  /* Responsive para tabla datos entrada */
  @media (max-width: 768px) {
    #tablaDatosEntrada {
      min-width: 350px;
    }

    #tablaDatosEntrada thead td {
      padding: 8px 4px;
      font-size: 10px;
      letter-spacing: 0;
    }

    #tablaDatosEntrada tbody td {
      padding: 8px 4px;
      font-size: 11px;
    }
  }

  @media (max-width: 480px) {
    #tablaDatosEntrada {
      min-width: 320px;
    }

    #tablaDatosEntrada thead td {
      padding: 6px 3px;
      font-size: 9px;
    }

    #tablaDatosEntrada tbody td {
      padding: 6px 3px;
      font-size: 10px;
    }
  }

  @media (max-width: 360px) {
    #tablaDatosEntrada {
      min-width: 300px;
    }

    #tablaDatosEntrada thead td {
      padding: 5px 2px;
      font-size: 8px;
    }

    #tablaDatosEntrada tbody td {
      padding: 5px 2px;
      font-size: 9px;
    }
  }

  /* Overlay de carga */
  .overlay-loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
  }

  .overlay-loading.mostrar {
    display: flex;
  }

  .loading-contenido {
    text-align: center;
  }

  .logo-latido {
    width: 150px;
    height: auto;
    animation: latido 1s ease-in-out infinite;
  }

  .texto-cargando {
    color: white;
    font-size: 18px;
    margin-top: 20px;
    font-weight: 600;
    letter-spacing: 2px;
  }

  @keyframes latido {
    0% {
      transform: scale(1);
    }

    25% {
      transform: scale(1.15);
    }

    50% {
      transform: scale(1);
    }

    75% {
      transform: scale(1.15);
    }

    100% {
      transform: scale(1);
    }
  }