/* YUSR V13.1 — Premium runtime + responsive geometry hardening */

/* Shared geometry: content is always allowed to shrink inside grid/flex tracks. */
main,.section,.container,.card,.dash-panel,.entity-card,.profile-shell,.profile-main,.profile-aside,
.form-grid,.detail-grid,.entity-grid,.filter-grid,.grid,.v13-premium-page,.v13-premium-page *,
.dashboard-mode .dash-content,.dashboard-mode .dash-content-inner,.dashboard-mode .dash-layout{
  min-width:0;
}
img,svg,video,canvas{max-width:100%}
input,select,textarea,button{max-width:100%}

/* Premium cards must not inherit desktop geometry on narrow screens. */
.v13-premium-page .v13-plans,.v13-premium-page .v13-plan-head,.v13-premium-page .v13-benefits-grid{width:100%;min-width:0}
.v13-premium-page .v13-plan{min-width:0;overflow:hidden}
.v13-premium-page .v13-plan h3,.v13-premium-page .v13-plan li,.v13-premium-page .v13-plan-head h2,
.v13-premium-page .v13-plan-head small{overflow-wrap:anywhere;word-break:normal}

@media(max-width:920px){
  html,body{width:100%;max-width:100%;overflow-x:hidden!important;overflow-x:clip!important}
  body.public-mode main,body.dashboard-mode main{width:100%;max-width:100%;overflow-x:clip}
  body.public-mode .section,body.dashboard-mode .app-dashboard{max-width:100%;overflow-x:clip}

  /* One predictable mobile gutter across public pages, including error states. */
  body.public-mode .section>.container,
  body.public-mode main>.container,
  body.public-mode .v91-error-page,
  body.public-mode .v13-premium-page>.container{
    width:calc(100% - 24px)!important;
    max-width:100%!important;
    margin-inline:auto!important;
  }

  body.public-mode .container{max-width:100%!important}
  body.public-mode .card,body.public-mode .entity-card,body.public-mode .dash-panel,
  body.public-mode form,body.public-mode fieldset{max-width:100%;min-width:0}

  /* Forms: no desktop columns or intrinsic controls may force page width. */
  .form-grid,.detail-grid,.filter-grid,.grid-2,.grid-3,.grid-4{min-width:0}
  .form-grid>* ,.detail-grid>* ,.filter-grid>*{min-width:0;max-width:100%}
  input,select,textarea{width:100%;min-width:0}

  /* Tables may scroll internally, never the whole page. */
  .table-wrap{width:100%;max-width:100%;overflow-x:auto!important;-webkit-overflow-scrolling:touch}

  /* Premium responsive rhythm. */
  .v13-premium-page{overflow-x:clip}
  .v13-premium-page .container{width:calc(100% - 24px)!important;padding-inline:0!important}
  .v13-premium-hero{padding:26px 20px!important;border-radius:24px!important;gap:16px!important}
  .v13-premium-hero h1{font-size:clamp(29px,8.4vw,38px)!important;letter-spacing:-.7px!important;line-height:1.28!important}
  .v13-premium-hero p{font-size:14px!important;line-height:1.85!important}
  .v13-benefits-grid{gap:11px!important;margin:18px 0 28px!important}
  .v13-benefit{min-height:0!important;padding:16px!important;border-radius:18px!important}
  .v13-plan-head{display:block!important;margin-bottom:14px!important}
  .v13-plan-head h2{font-size:clamp(22px,6.7vw,28px)!important;line-height:1.35!important;margin-top:7px!important}
  .v13-plan-head>small{display:block!important;font-size:12px!important;line-height:1.7!important;margin-top:8px!important}
  .v13-plans{grid-template-columns:minmax(0,1fr)!important;gap:13px!important;max-width:100%!important}
  .v13-plan{padding:20px!important;border-radius:21px!important;min-height:0!important;width:100%!important}
  .v13-price strong{font-size:36px!important}
  .v13-plan ul{gap:9px!important;margin-bottom:18px!important}

  /* Generic error card must fit the viewport when an exception occurs mid-page. */
  .v91-error-page{padding:16px 0 100px!important}
  .v91-error-card{width:100%!important;max-width:100%!important;padding:20px 16px!important;border-radius:20px!important}

  /* Dashboard geometry guard across roles. Keep intended horizontal scrollers internal. */
  body.dashboard-mode .dash-content,body.dashboard-mode .dash-content-inner,
  body.dashboard-mode .dash-panel,body.dashboard-mode .entity-card,body.dashboard-mode .card{
    max-width:100%!important;min-width:0!important;
  }
  body.dashboard-mode .dash-panel-head,body.dashboard-mode .section-head,
  body.dashboard-mode .entity-head,body.dashboard-mode .entity-person{min-width:0!important}
  body.dashboard-mode .dash-panel-head>*,body.dashboard-mode .section-head>*,
  body.dashboard-mode .entity-head>*,body.dashboard-mode .entity-person>*{min-width:0!important}
  body.dashboard-mode .dash-panel h1,body.dashboard-mode .dash-panel h2,body.dashboard-mode .dash-panel h3,
  body.dashboard-mode .entity-card h1,body.dashboard-mode .entity-card h2,body.dashboard-mode .entity-card h3{
    overflow-wrap:anywhere;word-break:normal;
  }
}

@media(max-width:480px){
  body.public-mode .section>.container,body.public-mode main>.container,
  body.public-mode .v91-error-page,body.public-mode .v13-premium-page>.container{
    width:calc(100% - 18px)!important;
  }
  .v13-premium-page .container{width:calc(100% - 18px)!important}
  .v13-premium-hero{padding:22px 17px!important}
  .v13-premium-hero h1{font-size:29px!important}
  .v13-premium-pill{font-size:11px!important}
  .v13-plan-top{align-items:flex-start!important;flex-wrap:wrap!important}
  .v13-plan-top span,.v13-plan-top b{max-width:100%!important}
  .v13-plan{padding:18px!important}
}
