/* SoluCalc v313 — normalização tipográfica das ferramentas.
   Interface em Sora; três níveis de densidade no desktop:
   normal 14 px, compacto 13 px e microtécnico 12 px.
   Blocos técnicos monoespaçados existentes permanecem preservados. */

body.solucalc-typography-v313{
  --sc313-font-ui:"Sora",Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  --sc313-type-normal:14px;
  --sc313-type-compact:13px;
  --sc313-type-micro:12px;
  --sc313-type-control:15px;
  --sc313-type-table:13.5px;
  --sc313-type-table-head:13px;
  --sc313-type-caption:12.75px;
  --sc313-type-card-title:15px;
}

/* Fonte da interface. Não alcança code/pre/kbd/samp nem blocos de fórmula monoespaçados. */
body.solucalc-typography-v313 :where(
  label,
  input,
  select,
  textarea:not(.ncr-textarea),
  button,
  table,
  th,
  td,
  figcaption,
  .numera-v93-caption,
  .calc-visual-caption,
  .stats-visual-caption,
  .po-visual-caption,
  .mb-visual-caption,
  .ms163-caption,
  .ntt-v1-rep-card,
  .numera-v94-representations-title,
  .numera-v94-solution-head,
  .numera-v94-solution-summary,
  .numera-v94-solution-card,
  .metric,
  .numera-v93-metric,
  .ms163-metric
){font-family:var(--sc313-font-ui)!important;}

/* Textos de diagramas e gráficos: mesma família visual, mantendo tamanhos individuais dos SVGs. */
body.solucalc-typography-v313 svg text,
body.solucalc-typography-v313 .numera-econ-svg text{
  font-family:var(--sc313-font-ui)!important;
}

/* Preserva usos técnicos deliberadamente monoespaçados. */
body.solucalc-typography-v313 :where(
  code,
  pre,
  kbd,
  samp,
  .nmb-formula-line,
  .nmb-kbd,
  .ncu-formula,
  .ncr-textarea
){
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace!important;
}

@media (min-width:981px){
  /* Nível normal — rótulos dos campos nas famílias predominantes. */
  body.solucalc-typography-v313 :where(
    .numera-v93-field > label,
    .ms163-field > label,
    #toolWorkspace .calc-field > label,
    .calc-field > label,
    .mock-field > label,
    .ntt-v1-form-card .numera-v93-field > label,
    .ntt-v1-tool-panel .numera-v93-field > label,
    .v213-template-main .numera-v93-field > label
  ){
    font-size:var(--sc313-type-normal)!important;
    line-height:1.22!important;
  }

  /* Entradas e seleções comuns — 15 px, sem reduzir a interface a 80%. */
  body.solucalc-typography-v313 :where(
    .numera-v93-input,
    .numera-v93-select,
    .ms163-field input,
    .ms163-field select,
    .ms163-field textarea,
    #toolWorkspace .calc-input,
    #toolWorkspace .calc-select,
    #toolWorkspace .calc-field input,
    #toolWorkspace .calc-field select,
    #toolWorkspace .calc-field textarea,
    .calc-field input,
    .calc-field select,
    .calc-field textarea,
    .mock-field input,
    .mock-field select,
    .mock-field textarea
  ){
    font-size:var(--sc313-type-control)!important;
    line-height:1.28!important;
  }

  /* Botões de ação. Botões ×/remoção não entram nesta lista. */
  body.solucalc-typography-v313 :where(
    .numera-v93-primary,
    .numera-v93-secondary,
    .ms163-actions button,
    .ntt-v1-actions button,
    #toolWorkspace .primary-action,
    #toolWorkspace .secondary-action,
    #toolWorkspace .small-action,
    .nmb-add-point,
    .nmb-add-row
  ){
    font-size:14px!important;
    line-height:1.2!important;
  }
  body.solucalc-typography-v313 :where(#toolWorkspace .small-action){font-size:13px!important;}

  /* Nível compacto — linhas densas e grids que precisam acomodar vários parâmetros. */
  body.solucalc-typography-v313 :where(
    .numera-v93-gestao-row,
    .ntt-v1-dynamic-row,
    .dynamic-row,
    .sim-row-5,
    .priority-row,
    .scale,
    .mat-v9496-input-grid,
    .root-v94100-coeff-grid
  ) :where(label,.numera-v93-field > label,.calc-field > label){
    font-size:var(--sc313-type-compact)!important;
    line-height:1.16!important;
  }

  /* Nível microtécnico — reservado a grades/matrizes realmente densas. */
  body.solucalc-typography-v313 :where(
    .ntt-v1-mod-grid,
    #pertRows .pert-row,
    #clientPriorityRows .client-priority-row,
    #r3Rows .dynamic-row
  ) :where(label,.numera-v93-field > label,.calc-field > label){
    font-size:var(--sc313-type-micro)!important;
    line-height:1.1!important;
  }

  /* Controles de matrizes e grades técnicas: compactos, mas acima dos antigos 11–12 px. */
  body.solucalc-typography-v313 :where(
    .mat-v9496-input-grid,
    .ntt-v1-mod-grid,
    .nmb-coord-grid,
    #pertRows,
    #clientPriorityRows,
    #r3Rows
  ) :where(input,select,textarea){
    font-size:14px!important;
  }

  /* Tabelas comuns. */
  body.solucalc-typography-v313 :where(
    .numera-v93-table,
    .data-table,
    .ms163-table,
    .ntt-v1-table-section table,
    #toolWorkspace table,
    .nmb-result-table,
    .nmb-truth-table
  ) :where(th,td){
    font-size:var(--sc313-type-table)!important;
    line-height:1.3!important;
  }
  body.solucalc-typography-v313 :where(
    .numera-v93-table,
    .data-table,
    .ms163-table,
    .ntt-v1-table-section table,
    #toolWorkspace table,
    .nmb-result-table,
    .nmb-truth-table
  ) th{
    font-size:var(--sc313-type-table-head)!important;
  }

  /* Tabelas microtécnicas: não obrigam o grid a alargar. */
  body.solucalc-typography-v313 :where(
    .mat-v9496-matrix-box,
    .root-v94100-table-scroll,
    #rkPortfolioTableV77Wrap
  ) :where(th,td){
    font-size:12.5px!important;
  }

  /* Títulos dos cards de representação e seções internas. */
  body.solucalc-typography-v313 :where(
    .numera-v93-visual-card > h3,
    .calc-visual-card > h4,
    .po-visual-card > h4,
    .ms163-visual > h3,
    .ms163-visual-card > h3,
    .ntt-v1-rep-card > h3,
    .ntt-v1-form-card > h3
  ){
    font-size:var(--sc313-type-card-title)!important;
    line-height:1.22!important;
  }

  /* Legendas e notas de representação. */
  body.solucalc-typography-v313 :where(
    figcaption,
    .numera-v93-caption,
    .calc-visual-caption,
    .stats-visual-caption,
    .po-visual-caption,
    .mb-visual-caption,
    .ms163-caption,
    .ntt-v1-rep-card .numera-v93-caption,
    .ntt-v1-visual-note,
    .numera-v94-dist-caption,
    .numera-v94-risk-caption,
    .numera-v94-mc-caption,
    .numera-v94-ts-caption
  ){
    font-size:var(--sc313-type-caption)!important;
    line-height:1.36!important;
  }

  /* Texto de indicadores: rótulo compacto e valor preservado em destaque. */
  body.solucalc-typography-v313 :where(
    .numera-v93-metric,
    .ms163-metric,
    #toolWorkspace .metric,
    .ntt-v1-embedded-workspace .mb-result-metric
  ) small{
    font-size:12.5px!important;
    line-height:1.2!important;
  }
}

/* Reforços de especificidade v313 — necessários porque algumas famílias legadas
   usam !important em seletores mais específicos. Mantidos isolados por família. */
@media (min-width:981px){
  body.solucalc-tool-page-v311.solucalc-typography-v313 .ms163-field > label{
    font-size:var(--sc313-type-normal)!important;
    line-height:1.22!important;
  }
  body.solucalc-tool-page-v311.solucalc-typography-v313 .ms163-field :where(input,select,textarea){
    font-size:var(--sc313-type-control)!important;
    line-height:1.28!important;
  }
  body.solucalc-tool-page-v311.solucalc-typography-v313 .ms163-actions button{
    font-size:14px!important;
    line-height:1.2!important;
  }
  body.solucalc-tool-page-v311.solucalc-typography-v313 .ms163-caption{
    font-size:var(--sc313-type-caption)!important;
    line-height:1.36!important;
  }

  body.solucalc-typography-v313 #toolWorkspace .calc-field > label{
    font-size:var(--sc313-type-normal)!important;
    line-height:1.22!important;
  }
  body.solucalc-typography-v313 #toolWorkspace .calc-field :where(input,select,textarea),
  body.solucalc-typography-v313 #toolWorkspace :where(.calc-input,.calc-select){
    font-size:var(--sc313-type-control)!important;
    line-height:1.28!important;
  }
  body.solucalc-typography-v313 #toolWorkspace :where(.primary-action,.secondary-action){
    font-size:14px!important;
    line-height:1.2!important;
  }
  body.solucalc-typography-v313 #toolWorkspace .small-action{
    font-size:13px!important;
    line-height:1.2!important;
  }
  body.solucalc-typography-v313 #toolWorkspace :where(.data-table,table) :where(th,td){
    font-size:var(--sc313-type-table)!important;
    line-height:1.3!important;
  }
  body.solucalc-typography-v313 #toolWorkspace :where(.data-table,table) th{
    font-size:var(--sc313-type-table-head)!important;
  }

  /* As exceções compactas/microtécnicas permanecem abaixo do nível normal. */
  body.solucalc-typography-v313 #toolWorkspace :where(
    .numera-v93-gestao-row,
    .dynamic-row,
    .sim-row-5,
    .priority-row,
    .scale,
    .mat-v9496-input-grid,
    .root-v94100-coeff-grid
  ) .calc-field > label{
    font-size:var(--sc313-type-compact)!important;
    line-height:1.16!important;
  }
  body.solucalc-typography-v313 #toolWorkspace :where(
    #pertRows .pert-row,
    #clientPriorityRows .client-priority-row,
    #r3Rows .dynamic-row
  ) .calc-field > label{
    font-size:var(--sc313-type-micro)!important;
    line-height:1.1!important;
  }
}
@media (min-width:981px){
  body.solucalc-tool-page-v311.solucalc-typography-v313 .ms163-field input,
  body.solucalc-tool-page-v311.solucalc-typography-v313 .ms163-field select,
  body.solucalc-tool-page-v311.solucalc-typography-v313 .ms163-field textarea{
    font-size:var(--sc313-type-control)!important;
    line-height:1.28!important;
  }
}
@media (min-width:981px){
  body.v209-ms-page.solucalc-tool-page-v311.solucalc-typography-v313 .ms163-card .ms163-field input,
  body.v209-ms-page.solucalc-tool-page-v311.solucalc-typography-v313 .ms163-card .ms163-field select,
  body.v209-ms-page.solucalc-tool-page-v311.solucalc-typography-v313 .ms163-card .ms163-field textarea{
    font:400 var(--sc313-type-control)/1.28 var(--sc313-font-ui)!important;
  }
}
