/* Smart Fin Reports — Phase 5.4.9.7 Unified Readability System
   Shared typography for data-entry screens, analysis tables and printable reports. */

#sfr-platform-root{
  --sfr-type-base:16px;
  --sfr-type-label:14px;
  --sfr-type-note:12.75px;
  --sfr-type-table:13.5px;
  --sfr-type-table-head:13px;
  --sfr-type-button:13.5px;
  --sfr-type-report:13.5px;
  --sfr-type-report-small:11.75px;
  --sfr-leading-base:1.65;
  --sfr-leading-compact:1.5;
}

/* Keep the overall interface calm, but make the actual working area readable. */
#sfr-platform-root [data-sfr-module-root]{
  font-family:"Cairo","Tajawal",Tahoma,Arial,sans-serif;
  font-size:var(--sfr-type-base);
  line-height:var(--sfr-leading-base);
  font-weight:500;
  text-rendering:optimizeLegibility;
  -webkit-font-smoothing:antialiased;
}

#sfr-platform-root [data-sfr-module-root] :is(button,input,select,textarea){
  font-family:"Cairo","Tajawal",Tahoma,Arial,sans-serif!important;
  font-size:15px!important;
  line-height:1.45!important;
}
#sfr-platform-root [data-sfr-module-root] :is(button,[role="button"]){
  font-size:var(--sfr-type-button)!important;
  font-weight:650!important;
}
#sfr-platform-root [data-sfr-module-root] :is(input,select,textarea){
  font-weight:550!important;
  min-height:44px;
}
#sfr-platform-root [data-sfr-module-root] :is(input[type="number"],input[type="date"],.num,.sfr-num,[data-number],td[data-value]){
  font-family:"JetBrains Mono",Consolas,monospace!important;
  font-variant-numeric:tabular-nums lining-nums;
  font-feature-settings:"tnum" 1,"lnum" 1;
  letter-spacing:-.012em;
}

/* Form labels and explanatory notes. */
#sfr-platform-root [data-sfr-module-root] :is(
  label>span,
  .sfr-pfa-field>span,
  [class*="form-grid"] label>span,
  [class*="fields"] label>span
){
  font-size:var(--sfr-type-label)!important;
  line-height:1.48!important;
  font-weight:650!important;
}
#sfr-platform-root [data-sfr-module-root] :is(
  label>small,
  .sfr-pfa-field>small,
  [class*="form-grid"] label>small,
  [class*="field"]>small,
  [class*="input"]>small
){
  font-size:var(--sfr-type-note)!important;
  line-height:1.58!important;
  font-weight:450!important;
}

/* Data tables: readable without making rows bulky. */
#sfr-platform-root [data-sfr-module-root] table :is(th,td){
  font-size:var(--sfr-type-table)!important;
  line-height:var(--sfr-leading-compact)!important;
  padding-block:11px;
}
#sfr-platform-root [data-sfr-module-root] table th{
  font-size:var(--sfr-type-table-head)!important;
  font-weight:650!important;
  letter-spacing:0;
}
#sfr-platform-root [data-sfr-module-root] table td{
  font-weight:520;
}
#sfr-platform-root [data-sfr-module-root] table td>strong{
  font-size:13.5px!important;
  font-weight:650!important;
}
#sfr-platform-root [data-sfr-module-root] table td>small,
#sfr-platform-root [data-sfr-module-root] table td small{
  font-size:12px!important;
  line-height:1.55!important;
  font-weight:450!important;
}
#sfr-platform-root [data-sfr-module-root] table input{
  font-size:14.5px!important;
  font-weight:600!important;
}

/* Section headers and supporting copy inside working screens. */
#sfr-platform-root [data-sfr-module-root] :is(
  [class*="panel"]>header>div>span,
  [class*="section-head"] p,
  [class*="page-head"] p,
  [class*="toolbar-copy"] p,
  [class*="hero-copy"] p
){
  font-size:12.5px!important;
  line-height:1.65!important;
}
#sfr-platform-root [data-sfr-module-root] :is(
  [class*="panel"]>header>small,
  [class*="table-note"],
  [class*="method-note"],
  [class*="long-copy"]
){
  font-size:12px!important;
  line-height:1.65!important;
}

/* Professional reports on screen. */
#sfr-platform-root [data-sfr-module-root] :is(
  [class*="report-page"],
  [class*="report-paper"]
){
  font-size:var(--sfr-type-report)!important;
  line-height:1.72!important;
}
#sfr-platform-root [data-sfr-module-root] :is(
  [class*="report-page"],
  [class*="report-paper"]
) :is(p,li,dd){
  font-size:var(--sfr-type-report)!important;
  line-height:1.78!important;
}
#sfr-platform-root [data-sfr-module-root] :is(
  [class*="report-page"],
  [class*="report-paper"]
) small{
  font-size:var(--sfr-type-report-small)!important;
  line-height:1.58!important;
}
#sfr-platform-root [data-sfr-module-root] :is(
  [class*="report-page"],
  [class*="report-paper"]
) h2{
  font-size:21px!important;
  line-height:1.4!important;
}
#sfr-platform-root [data-sfr-module-root] :is(
  [class*="report-page"],
  [class*="report-paper"]
) h3{
  font-size:16px!important;
  line-height:1.48!important;
}
#sfr-platform-root [data-sfr-module-root] :is(
  [class*="report-page"],
  [class*="report-paper"]
) table :is(th,td){
  font-size:12.5px!important;
  line-height:1.5!important;
  padding:9px 10px!important;
}
#sfr-platform-root [data-sfr-module-root] :is(
  [class*="report-list"],
  [class*="report-note"],
  [class*="report-alert"],
  [class*="methodology"]
) :is(div,p,span,small){
  font-size:12px!important;
  line-height:1.65!important;
}

/* Balanced contrast: stronger than before, without harsh white text. */
body:not(.dark-platform) #sfr-platform-root [data-sfr-module-root] :is(
  label>span,
  table th,
  [class*="panel"]>header>small,
  [class*="panel"]>header>div>span,
  [class*="page-head"] p,
  [class*="table-note"]
){color:#4b5e74!important}
body:not(.dark-platform) #sfr-platform-root [data-sfr-module-root] :is(
  label>small,
  table td>small,
  table td small
){color:#607287!important}

body.dark-platform #sfr-platform-root [data-sfr-module-root] :is(
  label>span,
  table th,
  [class*="panel"]>header>small,
  [class*="panel"]>header>div>span,
  [class*="page-head"] p,
  [class*="table-note"]
){color:#c0ccdb!important}
body.dark-platform #sfr-platform-root [data-sfr-module-root] :is(
  label>small,
  table td>small,
  table td small
){color:#aebdd0!important}
body:not(.dark-platform) #sfr-platform-root [data-sfr-module-root] table td>strong{color:#29435f!important}
body.dark-platform #sfr-platform-root [data-sfr-module-root] table td{color:#d5deea}
body.dark-platform #sfr-platform-root [data-sfr-module-root] table td>strong{color:#dbe7f4!important}

/* Compact displays keep their density, but never fall below a readable floor. */
@media(max-width:680px){
  #sfr-platform-root{
    --sfr-type-base:14.5px;
    --sfr-type-label:13px;
    --sfr-type-note:12px;
    --sfr-type-table:12.75px;
    --sfr-type-table-head:12.5px;
  }
  #sfr-platform-root [data-sfr-module-root] :is(input,select,textarea){font-size:14px!important}
}

/* Print: readable A4 typography, while preserving dense financial tables. */
@media print{
  #sfr-platform-root [data-sfr-module-root] :is([class*="report-page"],[class*="report-paper"]){
    font-size:10.5pt!important;
    line-height:1.52!important;
  }
  #sfr-platform-root [data-sfr-module-root] :is([class*="report-page"],[class*="report-paper"]) :is(p,li,dd){
    font-size:10.25pt!important;
    line-height:1.55!important;
  }
  #sfr-platform-root [data-sfr-module-root] :is([class*="report-page"],[class*="report-paper"]) small{
    font-size:8.75pt!important;
  }
  #sfr-platform-root [data-sfr-module-root] :is([class*="report-page"],[class*="report-paper"]) table :is(th,td){
    font-size:8.8pt!important;
    line-height:1.35!important;
    padding:5.5px 6px!important;
  }
  #sfr-platform-root [data-sfr-module-root] :is([class*="report-page"],[class*="report-paper"]) h2{font-size:16pt!important}
  #sfr-platform-root [data-sfr-module-root] :is([class*="report-page"],[class*="report-paper"]) h3{font-size:12pt!important}
}

/* ========================================================================== 
   Phase 4.6.8 — Focused analysis readability refinement
   Component-level overrides for text that remained too small after the
   shared typography pass. These preserve the compact executive layout.
   ========================================================================== */
#sfr-platform-root .sfr-eqa .sfr-eqa-panel>header{
  padding:16px 18px!important;
  min-height:70px;
}
#sfr-platform-root .sfr-eqa .sfr-eqa-panel>header span{
  font-size:12.25px!important;
  line-height:1.45!important;
  font-weight:650!important;
  letter-spacing:0!important;
}
#sfr-platform-root .sfr-eqa .sfr-eqa-panel>header h2{
  margin-top:5px!important;
  font-size:17.5px!important;
  line-height:1.42!important;
  font-weight:750!important;
}
#sfr-platform-root .sfr-eqa .sfr-eqa-panel>header small{
  max-width:46%;
  font-size:12px!important;
  line-height:1.55!important;
  font-weight:500!important;
}

#sfr-platform-root .sfr-eqa .sfr-eqa-metric-list{
  gap:10px!important;
  padding:16px!important;
}
#sfr-platform-root .sfr-eqa .sfr-eqa-metric-row{
  min-height:64px;
  gap:12px!important;
  padding:11px 13px!important;
}
#sfr-platform-root .sfr-eqa .sfr-eqa-metric-row strong{
  font-size:14px!important;
  line-height:1.42!important;
  font-weight:700!important;
}
#sfr-platform-root .sfr-eqa .sfr-eqa-metric-row span{
  margin-top:5px!important;
  font-size:12.25px!important;
  line-height:1.6!important;
  font-weight:480!important;
}
#sfr-platform-root .sfr-eqa .sfr-eqa-metric-row>b{
  font-size:13.75px!important;
  line-height:1.25!important;
  font-weight:800!important;
}
#sfr-platform-root .sfr-eqa .sfr-eqa-metric-row em,
#sfr-platform-root .sfr-eqa .sfr-eqa-badge{
  padding:5px 9px!important;
  font-size:10.5px!important;
  line-height:1.15!important;
  font-weight:750!important;
}

#sfr-platform-root .sfr-eqa .sfr-eqa-bridge{
  gap:9px!important;
  padding:17px!important;
}
#sfr-platform-root .sfr-eqa .sfr-eqa-bridge>div{
  min-height:42px;
  align-items:center;
  padding:11px 13px!important;
}
#sfr-platform-root .sfr-eqa .sfr-eqa-bridge span{
  font-size:13.25px!important;
  line-height:1.5!important;
  font-weight:560!important;
}
#sfr-platform-root .sfr-eqa .sfr-eqa-bridge strong{
  font-size:13.75px!important;
  line-height:1.35!important;
  font-weight:800!important;
}

/* Dark mode: raise contrast without using harsh pure white. */
body.dark-platform #sfr-platform-root .sfr-eqa .sfr-eqa-panel>header span,
body.dark-platform #sfr-platform-root .sfr-eqa .sfr-eqa-panel>header small{
  color:#aebed1!important;
}
body.dark-platform #sfr-platform-root .sfr-eqa .sfr-eqa-panel>header h2{
  color:#e3edf8!important;
}
body.dark-platform #sfr-platform-root .sfr-eqa .sfr-eqa-metric-row strong{
  color:#e0ebf7!important;
}
body.dark-platform #sfr-platform-root .sfr-eqa .sfr-eqa-metric-row span{
  color:#aebdd0!important;
}
body.dark-platform #sfr-platform-root .sfr-eqa .sfr-eqa-metric-row>b{
  color:#8fc8ff!important;
  text-shadow:none!important;
}
body.dark-platform #sfr-platform-root .sfr-eqa .sfr-eqa-bridge span{
  color:#afbed0!important;
}
body.dark-platform #sfr-platform-root .sfr-eqa .sfr-eqa-bridge strong{
  color:#b9d8f7!important;
}
body.dark-platform #sfr-platform-root .sfr-eqa .sfr-eqa-bridge .minus strong{
  color:#fb7185!important;
}
body.dark-platform #sfr-platform-root .sfr-eqa .sfr-eqa-bridge .plus strong{
  color:#34d399!important;
}
body.dark-platform #sfr-platform-root .sfr-eqa .sfr-eqa-bridge .result span,
body.dark-platform #sfr-platform-root .sfr-eqa .sfr-eqa-bridge .result strong{
  color:#5eead4!important;
}

/* Long tool names: show up to two balanced lines on desktop instead of ellipsis. */
@media(min-width:921px){
  #sfr-platform-root .sfr-header-copy{
    flex:1 1 auto;
    max-width:100%;
  }
  #sfr-platform-root .sfr-header-copy>strong{
    display:-webkit-box!important;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
    overflow:hidden!important;
    text-overflow:clip!important;
    white-space:normal!important;
    font-size:16.5px!important;
    line-height:1.28!important;
    letter-spacing:-.01em!important;
  }
  #sfr-platform-root .sfr-header-copy>span{
    margin-top:3px!important;
  }
}

@media(max-width:680px){
  #sfr-platform-root .sfr-eqa .sfr-eqa-panel>header{
    min-height:auto;
    align-items:flex-start;
  }
  #sfr-platform-root .sfr-eqa .sfr-eqa-panel>header small{
    max-width:100%;
  }
  #sfr-platform-root .sfr-eqa .sfr-eqa-metric-row{
    min-height:auto;
    padding:12px!important;
  }
}
