:root{
    --cb-bg:            #0b0f1a;
    --cb-panel:         #101828;
    --cb-panel-raised:  #141F33;
    --cb-line:          #232F47;
    --cb-line-soft:     #1B2438;

    --cb-radius:        10px;
}

.cb-wrap{
    font-family: var(--font-body);
    color: var(--text-1);
    max-width: 1360px;
    margin: 0 auto;
    padding: 32px 24px 80px;
}

/* ---------- Encabezado ---------- */
.cb-header{ margin-bottom: 32px; }
.cb-eyebrow{
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cb-gold);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.cb-eyebrow::before{
    content: "";
    width: 22px; height: 1px;
    background: var(--cb-gold);
    display: inline-block;
}
.cb-title{
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 32px;
    letter-spacing: -0.01em;
    margin: 0 0 6px;
    color: #F5F6F8;
}
.cb-subtitle{
    color: var(--text-2);
    font-size: 14.5px;
    max-width: 640px;
    line-height: 1.55;
}

/* ---------- Layout general ---------- */
.cb-grid{
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    gap: 20px;
    align-items: start;
}

@media (max-width: 980px){.cb-grid{ grid-template-columns: 1fr; }}

.calculator-card{
    background: var(--cb-panel);
    border: 1px solid var(--cb-line);
    border-radius: var(--cb-radius);
    overflow: hidden;
}

/* ---------- Tarjetas ---------- */
.cb-card{
    background: var(--cb-panel);
    border: 1px solid var(--cb-line);
    border-radius: var(--cb-radius);
    overflow: hidden;
}

.cb-card-head{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cb-line);
    background: var(--cb-panel-raised);
}
.cb-card-head h2{
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #F0F1F4;
}
.cb-card-head .cb-step{
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-3);
}
.cb-card-head {
font-size:      14px;
font-weight:    600;
letter-spacing: 0.16em;
text-transform: uppercase;
color:          var(--text-2);
margin:         2rem 0 1rem;
display:        flex;
align-items:    center;
gap:            10px;
}

.cb-card-head::after {
content:    '';
flex:       1;
height:     1px;
background: var(--border);
}



.cb-card-body{ padding: 20px; }

/* ---------- Formularios ---------- */
.cb-field{ margin-bottom: 14px; }
.cb-field label{
    display:block;
    font-size: 12px;
    color: var(--text-2);
    margin-bottom: 6px;
    font-weight: 500;
}

.input_row{ display:grid; grid-template-columns: 1fr 1fr 1fr; gap:14px; }

.cb-row2{ display:grid; grid-template-columns: 1fr 1fr; gap:14px; }
.cb-row3{ display:grid; grid-template-columns: 1fr 1fr 1fr; gap:14px; }

.cb-input, .cb-select{
    width: 100%;
    background: var(--cb-bg);
    border: 1px solid var(--cb-line);
    border-radius: 6px;
    color: var(--text-1);
    font-family: var(--font-mono);
    font-size: 13.5px;
    padding: 9px 11px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.cb-input:focus, .cb-select:focus{
    outline: none;
    border-color: var(--cb-gold);
    box-shadow: 0 0 0 3px var(--cb-gold-soft);
}
.cb-input::placeholder{ color: var(--text-3); }

/* datos generales -> FALTA PULIR */
.dcf-company-grid {
    display: grid;
    grid-template-columns:repeat(12, minmax(0, 1fr));
    gap: 14px;
}

.dcf-company-grid
.dash-field:nth-child(1) {
    grid-column: span 2;
}

.dcf-company-grid
.dash-field:nth-child(2) {
    grid-column: span 5;
}

.dcf-company-grid
.dash-field:nth-child(3) {
    grid-column: span 2;
}

.dcf-company-grid
.dash-field:nth-child(4) {
    grid-column: span 3;
}

.dcf-company-grid
.dash-field:nth-child(5) {
    grid-column: span 3;
}

.dcf-company-grid
.dash-field:nth-child(6) {
    grid-column: span 3;
}

.dcf-company-grid
.dash-field:nth-child(7) {
    grid-column: span 3;
}

.dcf-company-grid
.dash-field:nth-child(8) {
    grid-column: span 3;
}



/* ---------- Bloques dinamicos (amortizacion / tasas) ---------- */
.cb-dyn-row{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    padding: 14px;
    background: var(--cb-line-soft);
    border: 1px solid var(--cb-line);
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
}

.cb-dyn-row .cb-field{
    margin-bottom: 0;
    flex: 1 1 160px; /* crece/encoge, pero nunca baja de 160px -> ahi es cuando "salta" de linea */
    min-width: 0;    /* permite que el input interno no fuerce overflow */
}

/* Anchos relativos por posicion, respetando las proporciones que tenias en el grid */
.cb-dyn-row.cb-amort .cb-field:nth-child(1){ flex-basis: 140px; }
.cb-dyn-row.cb-amort .cb-field:nth-child(2){ flex-basis: 140px; }
.cb-dyn-row.cb-amort .cb-field:nth-child(3){ flex-basis: 150px; }
.cb-dyn-row.cb-amort .cb-field:nth-child(4){ flex-basis: 170px; }
.cb-dyn-row.cb-amort .cb-field:nth-child(5){ flex-basis: 170px; }

.cb-dyn-row.cb-rate .cb-field:nth-child(1){ flex-basis: 170px; }
.cb-dyn-row.cb-rate .cb-field:nth-child(2){ flex-basis: 170px; }
.cb-dyn-row.cb-rate .cb-field:nth-child(3){ flex-basis: 150px; }
.cb-dyn-row.cb-rate .cb-field:nth-child(4){ flex-basis: 160px; }

/* El boton de eliminar fila (el que antes era 32px en el grid) */
.cb-dyn-row .cb-remove-btn{
    flex: 0 0 32px;
    width: 32px;
}

/*  */
.cb-dyn-remove{
    width: 32px; height: 32px;
    border-radius: 6px;
    border: 1px solid var(--cb-line);
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    display:flex; align-items:center; justify-content:center;
    transition: all .15s ease;
}
.cb-dyn-remove:hover{ background: var(--cb-danger-soft); color: var(--cb-danger); border-color: var(--cb-danger); }

.cb-add-btn{
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    background: transparent;
    
    color: var(--text-2);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s ease;
}
.cb-add-btn:hover{ color: var(--cb-gold); background: var(--cb-gold-soft); }

/* ---------- Escalera de amortizacion (elemento distintivo, vista previa en vivo) ---------- */
.cb-ladder-title{
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 4px 0 10px;
}
.cb-ladder{
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 64px;
    padding: 0 2px;
    border-bottom: 1px solid var(--cb-line);
}
.cb-ladder-bar{
    flex: 1 1 auto;
    background: linear-gradient(180deg, var(--cb-gold) 0%, #8B7220 100%);
    border-radius: 2px 2px 0 0;
    min-width: 2px;
    transition: height .25s ease;
}
.cb-ladder-empty{
    font-size: 12px;
    color: var(--text-3);
    padding: 22px 0;
    text-align: center;
    width: 100%;
}

/* ---------- Botonera principal ---------- */
.cb-actions{
    display:flex;
    gap: 12px;
    align-items:center;
    margin-top: 24px;
}
.cb-btn{
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    padding: 12px 22px;
    border-radius: 7px;
    cursor: pointer;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all .15s ease;
}
.cb-btn-primary{
    background: var(--cb-gold);
    color: #191204;
}
.cb-btn-primary:hover{ background: #DDB637; transform: translateY(-1px); }
.cb-btn-primary:disabled{ opacity: .55; cursor:not-allowed; transform:none; }
.cb-btn-ghost{
    background: transparent;
    border-color: var(--cb-line);
    color: var(--text-1);
}
.cb-btn-ghost:hover{ border-color: var(--cb-teal); color: var(--cb-teal); }

.cb-error-banner{
    display:none;
    background: var(--cb-danger-soft);
    border: 1px solid rgba(229,72,77,0.4);
    color: #FF9DA1;
    font-size: 13px;
    padding: 12px 14px;
    border-radius: 7px;
    margin-top: 16px;
    font-family: var(--font-mono);
}

/* ---------- Resultados ---------- */
.cb-results{ display:none; margin-top: 32px; }
.cb-summary{
    display:grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
@media (max-width: 780px){ .cb-summary{ grid-template-columns: repeat(2,1fr); } }
.cb-stat{
    background: var(--cb-panel);
    border: 1px solid var(--cb-line);
    border-radius: var(--cb-radius);
    padding: 16px 18px;
}
.cb-stat .lbl{
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-3);
    margin-bottom: 6px;
}
.cb-stat .val{
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 600;
    color: var(--text-1);
}
.cb-stat.gold .val{ color: var(--cb-gold); }
.cb-stat.teal .val{ color: var(--cb-teal); }

.cb-chart-wrap{
    background: var(--cb-panel);
    border: 1px solid var(--cb-line);
    border-radius: var(--cb-radius);
    padding: 20px;
    margin-bottom: 20px;
    height: 320px;
}

.cb-table-scroll{
    max-height: 460px;
    overflow: auto;
    border: 1px solid var(--cb-line);
    border-radius: var(--cb-radius);
}
table.cb-table{
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 12.5px;
}
table.cb-table thead th{
    position: sticky; top: 0;
    background: var(--cb-panel-raised);
    color: var(--text-2);
    text-align: right;
    font-weight: 500;
    padding: 10px 14px;
    border-bottom: 1px solid var(--cb-line);
    white-space: nowrap;
}
table.cb-table thead th:first-child,
table.cb-table thead th:nth-child(2){ text-align: left; }
table.cb-table tbody td{
    padding: 8px 14px;
    text-align: right;
    border-bottom: 1px solid var(--cb-line-soft);
    color: var(--text-1);
    white-space: nowrap;
}
table.cb-table tbody td:first-child,
table.cb-table tbody td:nth-child(2){ text-align: left; color: var(--text-2); }
table.cb-table tbody tr.cb-amort-row td{ background: rgba(201,162,39,0.05); }
table.cb-table tbody tr:hover td{ background: rgba(255,255,255,0.02); }
table.cb-table tfoot td{
    font-weight: 600;
    padding: 10px 14px;
    border-top: 1px solid var(--cb-line);
    color: var(--cb-gold);
}

.cb-results-actions{
    display:flex; justify-content: space-between; align-items:center;
    margin-bottom: 14px; flex-wrap: wrap; gap: 10px;
}
.cb-results-title{
    font-family: var(--font-display);
    font-size: 18px; font-weight: 600; color:#F0F1F4;
}

.cb-spinner{
    width:14px; height:14px;
    border: 2px solid rgba(0,0,0,0.25);
    border-top-color: #191204;
    border-radius:50%;
    animation: cb-spin .7s linear infinite;
    display:none;
}
@keyframes cb-spin{ to{ transform: rotate(360deg); } }


/* DESCRIPCIÓN DEL TEMPLATE SELECCIONADO */
.cb-selected-template {
  display: flex;
  align-items: center;
  gap: 12px;

  margin-bottom: 20px;
  padding: 12px 16px;

  background: rgba(79, 209, 197, 0.08);   /* teal muy suave, en línea con ChartTheme */
  border: 1px solid rgba(79, 209, 197, 0.25);
  border-left: 3px solid #4FD1C5;         /* mismo teal que ya usás en el gráfico de interés */
  border-radius: 8px;

  font-size: 0.9rem;
  animation: cb-selected-fade-in 0.25s ease-out;
}

.cb-selected-template[hidden] {
  display: none;
}

.cb-selected-template > i.bi-check-circle-fill {
  flex-shrink: 0;
  font-size: 1.1rem;
  color: #4FD1C5;
}

.cb-selected-template-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  line-height: 1.4;
}

.cb-selected-template-text strong {
  color: #E8EAED;         /* ajustá al color de texto principal que ya uses */
  font-weight: 600;
}

.cb-selected-template-text span {
  color: rgba(232, 234, 237, 0.65);   /* texto secundario, más apagado */
  font-weight: 400;
}

/* separador visual sutil entre label y descripción, sin agregar markup extra */
.cb-selected-template-text strong::after {
  content: '·';
  margin-left: 6px;
  color: rgba(79, 209, 197, 0.5);
}

@keyframes cb-selected-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* responsive: en mobile, descripción baja de línea en vez de recortarse */
@media (max-width: 640px) {
  .cb-selected-template-text {
    flex-direction: column;
    gap: 2px;
  }
  .cb-selected-template-text strong::after {
    display: none;
  }
}