/* Estilos propios de esta página. La base común está en assets/kalculia-ui.css. */
/* Respuesta directa bajo el titular: la cifra que buscan Google y los buscadores de IA */
.ad-answer { position: relative; max-width: 62ch; margin: var(--s-4) 0 var(--s-4); font-size: .95rem; line-height: 1.55; }
.ad-answer p { margin: 0; }
.ad-answer-more summary { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: -.6rem; cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; }
.ad-answer-more[open] summary { margin-bottom: 0; }
.ad-answer-more p { font-size: .9rem; color: var(--text-muted); }
.ad-field-hint { margin-top: var(--s-2); font-size: .82rem; color: var(--text-muted); }
.ad-example { margin-top: var(--s-2); }
.ad-example .btn { white-space: normal; text-align: left; }
.ad-advanced { margin: var(--s-2) 0 var(--s-4); }
.ad-advanced[open] > .iv-grid { margin-top: var(--s-4); }
.ad-advanced .toggle-field { margin-top: var(--s-4); }

/* Bloques del formulario */
.iv-block { margin: 0 0 var(--s-5); padding: 0; border: 0; }
.iv-block legend { font-weight: 700; font-size: .95rem; margin-bottom: var(--s-3); }
.iv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.iv-field { display: flex; flex-direction: column; gap: var(--s-1); font-size: .86rem; font-weight: 600; }
.iv-field input { width: 100%; font-variant-numeric: tabular-nums; }
.iv-field small { font-weight: 400; font-size: .78rem; color: var(--text-muted); line-height: 1.4; }

/* Filas de compras: fecha (opcional) · participaciones · precio · gastos · quitar */
.iv-lote-head, .iv-lote { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, .8fr) 44px; gap: var(--s-2); align-items: center; }
.iv-l-fechawrap { display: block; margin: 0; }
.iv-l-fechatxt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.iv-l-fecha { width: 100%; min-height: 44px; font-variant-numeric: tabular-nums; }
.iv-field--antes { margin-top: var(--s-4); max-width: 22rem; }
.iv-previas { margin: 0 0 var(--s-2); font-size: .82rem; color: var(--text-muted); line-height: 1.45; }
.iv-lote-head { font-size: .78rem; font-weight: 600; color: var(--text-muted); margin-bottom: var(--s-1); }
.iv-lote { margin-bottom: var(--s-2); }
.iv-lote input { width: 100%; font-variant-numeric: tabular-nums; }
.iv-quitar { width: 44px; height: 44px; border: 0; border-radius: var(--radius); background: var(--surface-2); color: var(--text-muted); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.iv-quitar:disabled { opacity: .35; cursor: default; }
@media (hover: hover) and (pointer: fine) { .iv-quitar:not(:disabled):hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--text); } }
#iv-add { margin-top: var(--s-1); }

/* Importar del bróker (el archivo se lee en el navegador) */
.iv-modo { display: inline-flex; gap: var(--s-1); margin-bottom: var(--s-4); padding: var(--s-1); background: var(--surface); border-radius: 999px; box-shadow: var(--shadow-sm); }
.iv-importar { margin-bottom: var(--s-4); padding: var(--s-4); border-radius: var(--radius-lg); background: var(--surface-2); font-size: .9rem; line-height: 1.55; }
.iv-importar p { margin: 0 0 var(--s-3); }
.iv-importar-priv { font-size: .84rem; color: var(--text-muted); }
.iv-file { position: relative; cursor: pointer; }
.iv-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.iv-file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.iv-pegar { margin-top: var(--s-3); }
.iv-pegar summary { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; font-size: .86rem; text-decoration: underline; text-underline-offset: 3px; }
.iv-pegar textarea { width: 100%; margin: var(--s-2) 0; font: .8rem/1.4 ui-monospace, Consolas, monospace; }
#iv-imp-res:empty { display: none; }
#iv-imp-res { margin-top: var(--s-4); }
#iv-imp-res select { width: 100%; min-height: 44px; margin: var(--s-2) 0 var(--s-3); }
.iv-imp-error { color: var(--danger, #b42318); font-weight: 600; }
.iv-broker { display: grid; gap: var(--s-2); margin: 0 0 var(--s-3); font-weight: 600; font-size: .9rem; }
.iv-broker select { width: 100%; min-height: 44px; font-weight: 400; }
.iv-imp-aviso { padding: var(--s-2) var(--s-3); border-radius: var(--radius); background: var(--warning-soft, #fff4e5); font-size: .86rem; }
.iv-imp-broker { font-size: .86rem; color: var(--text-muted); }
.iv-emparejar { display: grid; gap: var(--s-3); margin-top: var(--s-3); padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--radius); }
.iv-emparejar p { margin: 0; }
.iv-emparejar label { display: grid; gap: var(--s-1); font-size: .86rem; }
#iv-imp-res .iv-emparejar select { margin: 0; }
.iv-emparejar .is-falta span { font-weight: 600; color: var(--danger, #b42318); }
.iv-revisar { margin-top: var(--s-3); }
.iv-revisar summary { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; font-size: .86rem; text-decoration: underline; text-underline-offset: 3px; }
.iv-imp-nota { margin: 0 0 var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--radius); background: var(--accent-soft); font-size: .86rem; line-height: 1.5; }

/* Resultado */
.cc-stat-row span:last-child { font-variant-numeric: tabular-nums; }
.cc-stat-row[hidden] { display: none; }
#iv-card-base .cc-option-title::before { background: var(--opt-b); }
.cc-stat-row .iv-tramo-sub { display: block; font-size: .76rem; color: var(--text-muted); font-weight: 400; }
.iv-planner { margin: var(--s-4) 0; padding: var(--s-4) var(--s-5); border-radius: var(--radius-lg); background: var(--accent-soft); color: var(--text); font-size: .92rem; line-height: 1.55; }
.iv-planner strong { color: var(--accent-dark, var(--accent)); }
.iv-planner:empty { display: none; }
.ai-risk { margin: var(--s-4) 0 0; padding: var(--s-3) var(--s-4); border-radius: var(--radius); background: var(--surface-2); font-size: .86rem; line-height: 1.55; color: var(--text-muted); }

@media (max-width: 559px) {
  .ad-answer { font-size: .9rem; }
  .ad-example .btn { width: 100%; min-height: 44px; }
  .iv-grid { grid-template-columns: 1fr; }
  .iv-lote-head { font-size: .72rem; }
  /* En el móvil la fecha va en su propia línea, con su texto visible */
  .iv-lote-head, .iv-lote { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .8fr) 44px; }
  .iv-lote-head span:first-child { display: none; }
  .iv-lote { padding-top: var(--s-2); border-top: 1px solid var(--border); }
  .iv-l-fechawrap { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s-2); }
  .iv-l-fechatxt { position: static; width: auto; height: auto; overflow: visible; clip: auto; flex: none; font-size: .78rem; font-weight: 600; color: var(--text-muted); }
  .iv-l-fecha { flex: 1; min-width: 0; }
  .iv-field--antes { max-width: none; }
  .iv-modo { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .iv-planner { padding: var(--s-3) var(--s-4); }
}
@media (max-width: 400px) { .iv-opc { display: none; } }
