/* ShahrVam v583 — final mobile QA hardening.
   Loaded last on purpose: closes verified overflow/overlay regressions without
   re-introducing page-specific desktop assumptions. */

/* ----- Mobile action sheet: close control must remain visible even when older
   enterprise selectors zero-out button font-size for icon-only close buttons. */
.sv-mobile-sheet__close{
  width:36px!important;height:36px!important;min-width:36px!important;
  display:grid!important;place-items:center!important;
  padding:0!important;border-radius:10px!important;
  line-height:1!important;font-size:16px!important;
}
.sv-mobile-sheet__close svg{
  width:18px!important;height:18px!important;display:block!important;
  fill:none!important;stroke:currentColor!important;stroke-width:2!important;
  stroke-linecap:round!important;stroke-linejoin:round!important;
}

/* ----- Notification center mobile header: short, stable header.  Device state
   lives in the preferences sheet at narrow widths so title never wraps. */
.v581-notify-prefs-device{padding:10px 11px 4px!important;overflow:visible!important}
.v581-prefs-device-btn{
  width:100%!important;min-height:38px!important;padding:7px 10px!important;
  border:1px solid #d9e4ea!important;border-radius:9px!important;
  background:#f7fafc!important;color:#365c73!important;
  font:inherit!important;font-size:10.5px!important;font-weight:800!important;
  white-space:normal!important;line-height:1.55!important;text-align:center!important;
}
@media (max-width:430px){
  .v581-notify-panel>header{gap:8px!important;padding-left:9px!important;padding-right:9px!important}
  .v581-notify-panel>header>div:first-child{min-width:0!important;flex:1 1 auto!important;gap:7px!important}
  .v581-notify-panel>header h2{min-width:0!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;font-size:15px!important;line-height:1.35!important}
  .v581-notify-head-actions{flex:0 0 auto!important;gap:5px!important}
  .v581-notify-head-actions>.v581-device-btn{display:none!important}
  .v581-notify-settings,.v581-notify-close{width:34px!important;height:34px!important;min-width:34px!important}
}

/* ----- Reconciliation: verified no-horizontal-overflow contract. */
@media (max-width:900px){
  body[data-page="reconciliation"] #page-content,
  body[data-page="reconciliation"] #page-content>*{
    min-width:0!important;max-width:100%!important;
  }
  body[data-page="reconciliation"] :is(
    .reconciliation-report-page,.rec-report-page,.rec-report-hero,.rec-workflow,
    .rec-report-summary,.rec-batch-meta,.rec-report-list-card,.rec-controls,
    .rec-report-search,.rec-search-input-shell,.rec-search-result,.rec-view-filters,
    .rec-report-section-head,.rec-report-section-actions,.rec-header-icon-actions,
    .rec-work-group,.rec-work-group-head,.rec-group-stats,.rec-group-actions,
    .rec-case-card-grid,.rec-bulk-bar
  ){
    min-width:0!important;max-width:100%!important;box-sizing:border-box!important;
  }
  body[data-page="reconciliation"] .rec-controls{
    width:100%!important;grid-template-columns:minmax(0,1fr)!important;
  }
  body[data-page="reconciliation"] .rec-report-search{
    width:100%!important;display:grid!important;grid-template-columns:minmax(0,1fr)!important;
    align-items:stretch!important;
  }
  body[data-page="reconciliation"] .rec-search-input-shell,
  body[data-page="reconciliation"] .rec-search-result{
    width:100%!important;min-width:0!important;max-width:100%!important;
  }
  body[data-page="reconciliation"] .rec-view-filters{
    width:100%!important;max-width:100%!important;min-width:0!important;
    overflow-x:auto!important;overflow-y:hidden!important;
    scrollbar-width:thin!important;overscroll-behavior-inline:contain!important;
  }
  body[data-page="reconciliation"] .rec-view-filter{flex:0 0 auto!important;min-width:max-content!important}
  body[data-page="reconciliation"] .rec-report-section-head{
    display:grid!important;grid-template-columns:40px minmax(0,1fr)!important;
    align-items:center!important;
  }
  body[data-page="reconciliation"] .rec-report-section-actions{
    grid-column:1/-1!important;margin:0!important;width:100%!important;
    display:flex!important;flex-wrap:wrap!important;gap:6px!important;
  }
  body[data-page="reconciliation"] .rec-report-section-actions>*{
    min-width:0!important;max-width:100%!important;flex:1 1 130px!important;
  }
  body[data-page="reconciliation"] .rec-work-group-head{
    grid-template-columns:minmax(0,1fr)!important;
  }
  body[data-page="reconciliation"] :is(.rec-group-stats,.rec-group-actions){
    min-width:0!important;max-width:100%!important;display:flex!important;flex-wrap:wrap!important;
    justify-content:flex-start!important;
  }
  body[data-page="reconciliation"] :is(.rec-group-stats,.rec-group-actions)>*{min-width:0!important;max-width:100%!important}
  body[data-page="reconciliation"] .rec-header-icon-actions{
    width:100%!important;max-width:100%!important;display:flex!important;flex-wrap:wrap!important;
  }
  body[data-page="reconciliation"] .rec-header-icon-actions>*{min-width:0!important;max-width:100%!important}
}
@media (max-width:430px){
  body[data-page="reconciliation"] .rec-workflow{
    width:100%!important;display:grid!important;grid-template-columns:minmax(0,1fr)!important;
    gap:6px!important;padding:8px!important;
  }
  body[data-page="reconciliation"] .rec-workflow>i{display:none!important}
  body[data-page="reconciliation"] .rec-workflow>div{
    width:100%!important;min-width:0!important;padding:6px 7px!important;
    border:1px solid #e2e9ef!important;border-radius:10px!important;
  }
  body[data-page="reconciliation"] .rec-batch-meta{grid-template-columns:minmax(0,1fr)!important}
  body[data-page="reconciliation"] .rec-report-summary{grid-template-columns:minmax(0,1fr)!important}
  body[data-page="reconciliation"] .rec-head-action{min-width:40px!important;max-width:100%!important}
}

/* ----- Dashboard: only very narrow widths had residual overflow.  Header actions
   become rows instead of being pushed beyond the left edge. */
@media (max-width:370px){
  body[data-page="dashboard"] .v513-dashboard,
  body[data-page="dashboard"] .v513-dashboard-shell-loading{
    width:100%!important;max-width:100%!important;min-width:0!important;
    margin:0!important;padding-left:8px!important;padding-right:8px!important;
    box-sizing:border-box!important;
  }
  body[data-page="dashboard"] .v513-dashboard>*{min-width:0!important;max-width:100%!important}
  body[data-page="dashboard"] :is(.v513-zone,.v513-panel,.v513-secondary-grid,.v513-decision-grid,.v513-flow-grid){
    min-width:0!important;max-width:100%!important;
  }
  body[data-page="dashboard"] .v513-secondary-grid,
  body[data-page="dashboard"] .v513-decision-grid{
    grid-template-columns:minmax(0,1fr)!important;
  }
  body[data-page="dashboard"] .v513-panel>header{
    width:100%!important;max-width:100%!important;min-width:0!important;
    display:flex!important;flex-wrap:wrap!important;align-items:flex-start!important;
  }
  body[data-page="dashboard"] .v513-panel>header>div{min-width:0!important;max-width:100%!important;flex:1 1 140px!important}
  body[data-page="dashboard"] .v513-panel>header>button{
    position:static!important;inset:auto!important;transform:none!important;
    width:100%!important;max-width:100%!important;min-width:0!important;
    flex:1 1 100%!important;margin:0!important;white-space:normal!important;
  }
  body[data-page="dashboard"] .v513-panel .table-wrap{width:100%!important;max-width:100%!important;min-width:0!important}
}
