/* P0.5 Final Mobile Typography Layer
   Loaded last on every canonical route.
   Page CSS owns layout/colour; this layer owns mobile readability. */

@media(max-width:899px){
  :root{
    --m-type-page:30px;
    --m-type-section:22px;
    --m-type-card-title:18px;
    --m-type-body:15px;
    --m-type-helper:13px;
    --m-type-label:12px;
    --m-type-badge:12px;
    --m-leading-body:1.48;
  }

  /* Global readable floor */
  body{font-size:var(--m-type-body)!important}
  button,input,select,textarea{font-size:16px!important}
  small{line-height:1.4}

  /* Shared page hierarchy */
  .d-title h1,.p-head h1,.wp-head h1,.pv-head h1,.bc-head h1,.sys-head h1,.so-head h1{
    font-size:var(--m-type-page)!important;line-height:1.1!important;letter-spacing:-.035em!important
  }
  .d-title p,.p-head p,.wp-head p,.pv-head p,.bc-head p,.sys-head p,.so-head p{
    font-size:16px!important;line-height:var(--m-leading-body)!important
  }
  .p-eyebrow,.wp-eyebrow,.pv-eyebrow,.bc-eyebrow,.sys-eyebrow,
  .di-header>div:first-child>span,.sca-card>header>div>span{
    font-size:13px!important;line-height:1.25!important;letter-spacing:.1em!important
  }

  /* Data quality + freshness must be readable everywhere */
  .asx-quality-guard{padding:12px 14px!important;gap:10px!important}
  .asx-quality-guard b{font-size:14px!important;line-height:1.3!important}
  .asx-quality-guard small{font-size:13px!important;line-height:1.45!important}
  .asx-freshness-strip{gap:7px!important}
  .asx-freshness-item{padding:8px 10px!important;min-height:46px!important}
  .asx-freshness-item em{font-size:11px!important}
  .asx-freshness-item b{font-size:13px!important}
  .asx-freshness-item i{font-size:10px!important;padding:3px 6px!important}
  .mls-note,.mls-chart-note,.so-model-meaning{font-size:13px!important;line-height:1.45!important}

  /* Dashboard / signal cards */
  .signals-head h2{font-size:27px!important}
  .signals-head p{font-size:15px!important;line-height:1.45!important}
  .dm-card-title b{font-size:20px!important}
  .dm-card-title small{font-size:14px!important;line-height:1.35!important}
  .dm-card-grid span{font-size:12px!important}
  .dm-card-grid b{font-size:15px!important;line-height:1.35!important}
  .dm-card-foot{font-size:13px!important}
  .d-badge,.d-source,.badge{font-size:12px!important;padding:5px 8px!important}

  /* Production / Shadow */
  .p-hero span,.wp-kpi span,.pv-kpi span,.bc-kpi span,.sys-kpi span,.c-kpis span,.f-kpis span{
    font-size:16px!important;line-height:1.3!important
  }
  .p-hero strong,.wp-kpi strong,.pv-kpi strong,.bc-kpi strong,.sys-kpi strong,.c-kpis strong,.f-kpis strong{
    font-size:36px!important;line-height:1!important
  }
  .p-hero small,.wp-kpi small,.pv-kpi small,.bc-kpi small,.sys-kpi small,.c-kpis small,.f-kpis small{
    font-size:14px!important;line-height:1.4!important
  }
  .p-tools>div>b,.p-section-head b{font-size:18px!important}
  .p-tools small,.p-section-head small{font-size:14px!important}
  .p-mobile-title b{font-size:20px!important}
  .p-mobile-card summary>div>small{font-size:14px!important}
  .p-mobile-next span,.p-mobile-core span{font-size:12px!important}
  .p-mobile-next strong,.p-mobile-core b{font-size:15px!important;line-height:1.4!important}

  /* Daily Changes */
  .dc-run span{font-size:13px!important;padding:8px 10px!important}
  .dc-kpis span{font-size:13px!important}
  .dc-kpis strong{font-size:34px!important;line-height:1!important}
  .dc-kpis small{font-size:14px!important;line-height:1.4!important}
  .dc-coverage{font-size:13px!important;line-height:1.45!important}
  .dc-pills button,.dc-filter-row select{font-size:14px!important;min-height:44px!important}
  .dc-search input{font-size:16px!important}
  .dc-tools #dcCount{font-size:12px!important}
  .dc-main time{font-size:12px!important}
  .dc-priority,.dc-category,.dc-model{font-size:11px!important;padding:5px 8px!important}
  .dc-title a:first-child{font-size:18px!important}
  .dc-title h3{font-size:17px!important;line-height:1.35!important}
  .dc-open{font-size:14px!important}
  .dc-main>p{font-size:14px!important;line-height:1.5!important}
  .dc-details small{font-size:11px!important}
  .dc-details b{font-size:13px!important;line-height:1.35!important}
  .dc-empty p{font-size:14px!important}
  .dc-alert-status span{font-size:11px!important}
  .dc-alert-status strong{font-size:14px!important}
  .dc-alert-status small{font-size:13px!important}
  .dc-alert-status code{font-size:11px!important}

  /* Decision Inbox */
  .di-loading{font-size:14px!important}
  .di-header h2{font-size:22px!important;line-height:1.2!important}
  .di-header p{font-size:14px!important;line-height:1.45!important}
  .di-counts>span{font-size:11px!important;min-width:58px!important}
  .di-counts b{font-size:24px!important}
  .di-card{padding:14px!important}
  .di-card-top b{font-size:19px!important}
  .di-card-top small{font-size:14px!important;line-height:1.35!important;max-width:none!important}
  .di-priority{font-size:11px!important;padding:5px 8px!important}
  .di-action strong{font-size:17px!important;line-height:1.3!important}
  .di-action p{font-size:14px!important;line-height:1.48!important}
  .di-facts span{font-size:11px!important;padding:9px!important}
  .di-facts b{font-size:14px!important;line-height:1.35!important}
  .di-evidence span{font-size:11px!important}
  .di-evidence b{font-size:13px!important;line-height:1.4!important}
  .di-card-foot>span{font-size:12px!important}
  .di-card-foot a{font-size:14px!important}
  .di-panel>footer{font-size:12px!important;line-height:1.4!important}
  .di-empty strong{font-size:16px!important}
  .di-empty span{font-size:13px!important}

  /* Stock Overview */
  .so-symbol{font-size:14px!important;padding:6px 10px!important}
  .so-price strong{font-size:34px!important}
  .so-price small{font-size:13px!important}
  .so-status span{font-size:11px!important}
  .so-status b{font-size:16px!important}
  .so-status small{font-size:13px!important;line-height:1.4!important}
  .so-panel header h2{font-size:18px!important}
  .so-panel header small{font-size:13px!important}
  .so-model h3{font-size:15px!important}
  .so-model .so-row,.so-list .so-row{font-size:14px!important;line-height:1.4!important}
  .so-empty{font-size:14px!important}
  .so-actions a{font-size:14px!important;min-height:46px!important}
  .so-note{font-size:13px!important}
  .so-chip{font-size:11px!important;padding:5px 8px!important}
  .so-page-actions button,.so-page-actions a{font-size:14px!important;min-height:46px!important}
  .so-chart-disclosure>summary span{font-size:16px!important}
  .so-chart-disclosure>summary small{font-size:12px!important}
  .so-chart-controls label{font-size:12px!important}
  .so-range button{font-size:12px!important}
  .so-chart-loading{font-size:14px!important}
  .so-chart-legend{font-size:12px!important}
  .so-position span{font-size:11px!important}
  .so-position-price strong{font-size:28px!important}
  .so-position-model b{font-size:15px!important}
  .so-position-model small{font-size:13px!important}
  .so-position-rel b,.so-position-next b{font-size:14px!important}

  /* Single Current Action */
  .sca-loading{font-size:14px!important}
  .sca-card>header{padding:14px!important}
  .sca-card h3{font-size:22px!important;line-height:1.2!important}
  .sca-card>header p{font-size:14px!important;line-height:1.48!important}
  .sca-role{font-size:11px!important;padding:5px 8px!important}
  .sca-facts span,.sca-evidence>span{font-size:11px!important}
  .sca-facts b,.sca-evidence b{font-size:14px!important;line-height:1.35!important}
  .sca-facts>div{padding:10px!important}
  .sca-fine{font-size:12px!important;line-height:1.4!important}
  .sca-card.compact>div:first-child>span{font-size:11px!important}
  .sca-card.compact strong{font-size:16px!important}
  .sca-card.compact small{font-size:13px!important}
  .sca-compact-facts b{font-size:11px!important}

  /* Risk / execution intelligence */
  .ri-section h3,.ri-overview h2{font-size:18px!important}
  .ri-section header small,.ri-overview header small{font-size:13px!important;line-height:1.4!important}
  .ri-card span{font-size:11px!important}
  .ri-card strong{font-size:15px!important}
  .ri-card small{font-size:13px!important;line-height:1.4!important}
  .ri-badge{font-size:11px!important}
  .ri-split b{font-size:14px!important}
  .ri-link{font-size:13px!important}
  .ri-next-main>div>span{font-size:11px!important}
  .ri-next-main strong{font-size:18px!important}
  .ri-next-main small{font-size:13px!important}
  .ri-summary-grid>div>span{font-size:11px!important}
  .ri-summary-grid>div>strong{font-size:14px!important}
  .ri-summary-grid>div>small{font-size:12px!important}
  .ri-lifecycle>div b{font-size:11px!important}
  .ri-lifecycle>div span{font-size:12px!important}
  .ri-lifecycle>div small{font-size:11px!important}
  .ri-details summary{font-size:13px!important}
  .ri-detail-block h4{font-size:12px!important}
  .ri-detail-block p{font-size:13px!important}
  .ri-thresholds>span{font-size:11px!important}
  .ri-thresholds>span small{font-size:10px!important}
  .ri-mini-row span{font-size:11px!important}
  .ri-portfolio-fit>span:first-child{font-size:11px!important}
  .ri-portfolio-fit>strong{font-size:14px!important}
  .ri-portfolio-fit>small{font-size:12px!important}
  .hc-stream h5{font-size:11px!important}
  .hc-lineage span{font-size:10px!important}
  .hc-lineage b{font-size:12px!important}
  .hc-lineage small{font-size:10px!important}
  .ri-stock-hcal>span,.wp-hcal-grid>div>span{font-size:11px!important}
  .ri-stock-hcal>strong,.wp-hcal-grid>div>strong{font-size:14px!important}
  .ri-stock-hcal>small,.wp-hcal-grid>div>small{font-size:12px!important}

  /* Forward Research */
  .f-lens .eyebrow{font-size:13px!important}
  .f-lens h2{font-size:22px!important;line-height:1.3!important}
  .f-lens p{font-size:15px!important;line-height:1.52!important}
  .f-pipeline-card span{font-size:12px!important}
  .f-pipeline-card strong{font-size:18px!important}
  .f-pipeline-card small{font-size:14px!important}
  .f-filter{font-size:14px!important}
  .f-note b{font-size:15px!important}
  .f-note p{font-size:14px!important}
  .f-mobile-card summary b{font-size:17px!important}
  .f-mobile-card summary small{font-size:13px!important}
  .f-mobile-right strong{font-size:14px!important}
  .f-mobile-lines span{font-size:12px!important}
  .f-mobile-lines b{font-size:13px!important}

  /* Portfolio */
  .wp-tab{font-size:17px!important}
  .wp-filter{font-size:14px!important}
  .wp-mobile-card summary b{font-size:18px!important}
  .wp-mobile-card small{font-size:14px!important}
  .wp-mobile-lines span{font-size:12px!important}
  .wp-mobile-lines b{font-size:14px!important}

  /* Bottom navigation stays readable but compact */
  .site-mobile-nav a,.site-mobile-nav button{font-size:12px!important;font-weight:700!important}
  .site-mobile-more-group-title{font-size:11px!important}
  .site-mobile-more-grid a,.site-mobile-signals-grid a{font-size:15px!important}
}


/* P0.5.1 · Mobile Overflow Correction
   Keep readable type; reflow legacy dense components instead of shrinking text. */
@media(max-width:899px){
  html,body{max-width:100%;overflow-x:hidden}
  .d-shell,.p-main,.wp-main,.pv-main,.bc-main,.sys-main,.so-main,
  .di-host,.di-panel,.di-header,.di-grid,.di-card,.di-card-top,.di-action,.di-facts,.di-evidence,.di-card-foot{
    min-width:0!important;max-width:100%!important
  }
  .di-card *, .sca-card *, .dc-event *, .so-panel *{min-width:0}
  .di-action p,.di-evidence b,.di-card-foot,.di-card-top small,
  .sca-card p,.dc-main>p,.dc-details b,.so-row b{
    overflow-wrap:anywhere;word-break:normal
  }

  /* Inbox header: do not let counters force page width. */
  .di-header{display:block!important;padding:16px!important}
  .di-header>div:first-child{min-width:0!important}
  .di-header h2{font-size:22px!important}
  .di-header p{max-width:none!important;margin-top:6px!important}
  .di-counts{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px!important;margin-top:12px!important;width:100%!important}
  .di-counts>span{min-width:0!important;width:auto!important;padding:9px 10px!important}
  .di-counts b{font-size:24px!important}

  /* Inbox cards: two-column facts, stacked evidence, wrap actions. */
  .di-card-top{align-items:flex-start!important}
  .di-card-top>div:first-child{min-width:0!important;flex:1 1 auto!important}
  .di-priority{flex:0 0 auto!important}
  .di-facts{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  .di-facts>span{min-width:0!important}
  .di-facts>span:nth-child(3):last-child{grid-column:1/-1}
  .di-facts b{white-space:normal!important;overflow-wrap:anywhere!important}
  .di-evidence{gap:8px!important}
  .di-evidence li{display:block!important}
  .di-evidence span{display:block!important;margin-bottom:3px!important}
  .di-evidence b{display:block!important}
  .di-card-foot{display:flex!important;flex-wrap:wrap!important;align-items:center!important;gap:8px 10px!important}
  .di-card-foot>span{flex:1 1 150px!important}
  .di-card-foot>div{display:flex!important;flex:0 1 auto!important;flex-direction:row!important;align-items:center!important;gap:10px!important;margin-left:auto!important}
  .di-card-foot a{white-space:normal!important;text-align:right!important}

  /* Similar mobile metric groups should compress before they overflow. */
  .sca-facts,.sca-evidence,.dc-details,.ri-summary-grid,.wp-risk-board{
    grid-template-columns:repeat(2,minmax(0,1fr))!important
  }
  .sca-facts b,.sca-evidence b,.dc-details b,.ri-summary-grid strong,.wp-risk-board strong{
    overflow-wrap:anywhere!important
  }
}

@media(max-width:430px){
  /* Narrow phones: favour vertical readability over squeezing. */
  .di-card{padding:13px!important}
  .di-card-top{gap:8px!important}
  .di-card-top b{font-size:18px!important}
  .di-action strong{font-size:16px!important}
  .di-facts{grid-template-columns:1fr 1fr!important}
  .di-facts>span:nth-child(3){grid-column:1/-1}
  .di-card-foot>div{width:100%!important;justify-content:flex-end!important}
  .sca-facts,.sca-evidence{grid-template-columns:1fr 1fr!important}
}
