/* FM27 R27.35: ONE shared presentation system for all frontend routes.
   Old view templates supply CONTENT only. Controller applies data-fm27-context-bar.
   Deliberately loaded LAST to supersede historical per-page green skins. */
body.fm27-unified-ui{
  margin:0;
  --fm27-ctx-bg:linear-gradient(115deg,#171e33 0%,#1b2941 68%,#132e35 100%);
  --fm27-ctx-toolbar:#18243a;
  --fm27-ctx-border:#40536c;
  --fm27-ctx-color:#eff4fd;
  --fm27-ctx-muted:#a8bbd0;
  --fm27-ctx-accent:#5dc1a3;
  --fm27-ctx-btn:#20324b;
  --fm27-ctx-btn-border:#526781;
}
/* Full width, no old outer content box or breadcrumb regardless of page family. */
body.fm27-unified-ui .ws-app.fm27-app,
body.fm27-unified-ui .ws-app.fm27-app.container-fluid,
body.fm27-unified-ui .fm27-main,
body.fm27-unified-ui #contentArea,
body.fm27-unified-ui #pagecontent,
body.fm27-unified-ui .fm27-ui-content-surface{
  max-width:none!important;width:100%!important;min-width:0!important;
}
body.fm27-unified-ui #contentArea{flex:0 0 100%!important;max-width:100%!important}
body.fm27-unified-ui .fm27-ui-content-surface{margin:0!important;padding:0!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important}
body.fm27-unified-ui .ws-app.fm27-app{padding-left:clamp(10px,1.25vw,26px)!important;padding-right:clamp(10px,1.25vw,26px)!important}
body.fm27-unified-ui .fm27-main .row{min-width:0}
body.fm27-unified-ui .fm27-main .col-12,
body.fm27-unified-ui .fm27-main .col-md-12{min-width:0}
body.fm27-unified-ui #pagecontent [id^="help_"][id$="_block"],
body.fm27-unified-ui .breadcrumb,body.fm27-unified-ui .ws-page-header.page-header{display:none!important}
/* Existing match scoreboard is PRIMARY match content, not a duplicate page header. */
body.fm27-unified-ui .fm27-p2,body.fm27-unified-ui .fm27-p2-match,
body.fm27-unified-ui .fm27-r8313-match,body.fm27-unified-ui .fm27-r8313-matchcard,
body.fm27-unified-ui .fm27-v8512-live-panel{max-width:none!important;width:100%!important;min-width:0!important}
body.fm27-unified-ui #pagecontent .fm27-p2-match{margin-inline:0!important}
/* Normalize ALL original bar families: shared height, background, typography, corners. */
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"]:not([hidden]){
  box-sizing:border-box!important;display:flex!important;align-items:center!important;
  flex-flow:row wrap!important;justify-content:space-between!important;
  column-gap:15px!important;row-gap:8px!important;
  width:100%!important;max-width:none!important;min-width:0!important;min-height:68px!important;
  margin:3px 0 6px!important;padding:11px 16px!important;
  border:1px solid var(--fm27-ctx-border)!important;border-left:3px solid var(--fm27-ctx-accent)!important;
  border-radius:9px!important;background:var(--fm27-ctx-bg)!important;
  color:var(--fm27-ctx-color)!important;box-shadow:none!important;
  font:inherit!important;text-align:left!important;
}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"]:not([hidden]){
  box-sizing:border-box!important;display:flex!important;flex-flow:row wrap!important;
  align-items:center!important;justify-content:space-between!important;
  column-gap:12px!important;row-gap:7px!important;
  width:100%!important;max-width:none!important;min-width:0!important;min-height:45px!important;
  margin:0 0 12px!important;padding:7px 11px!important;
  border:1px solid #374a64!important;border-radius:9px!important;
  background:var(--fm27-ctx-toolbar)!important;color:var(--fm27-ctx-color)!important;
  box-shadow:none!important;font:inherit!important;
}
body.fm27-unified-ui #contentArea [data-fm27-context-bar][hidden],
body.fm27-unified-ui #contentArea [data-fm27-context-root][hidden],
body.fm27-unified-ui #contentArea .fm27-management-bands[hidden],
body.fm27-unified-ui #contentArea .fm27-recruitment-bands[hidden]{display:none!important}
/* Shared title + compact summary right, even when existing content uses older DOM structure. */
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] :is(
  .fm27-r272523-title,.fm27-r272529-title,.fm27-training-summary-title,
  .fm27-staff-summary-title,.fm27-camp-summary-title,.fm27-cp-identity,
  .fm27-recruitment-kicker,.fm27-management-kicker,.fm27-context-band-caption
){min-width:0!important;flex:0 0 auto!important;margin:0!important;background:transparent!important;border:0!important;box-shadow:none!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] :is(.fm27-r272523-title,.fm27-r272529-title){display:flex!important;flex-direction:column!important;gap:3px!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] :is(.fm27-r272523-title,.fm27-r272529-title) > span,
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] .fm27-cp-kicker{font-size:10px!important;font-weight:750!important;letter-spacing:.1em!important;color:#8dcfbc!important;line-height:1.25!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] :is(.fm27-r272523-title,.fm27-r272529-title) > strong,
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] :is(.fm27-cp-headline h2){font-size:1.1rem!important;color:#f2f6fd!important;font-weight:780!important;line-height:1.2!important;margin:0!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] :is(.fm27-roster-metric,.fm27-management-stat,.fm27-recruitment-stat,.fm27-camp-summary-metric){
  flex:0 1 auto!important;max-width:290px!important;min-width:95px!important;
  width:auto!important;min-height:0!important;display:flex!important;flex-direction:column!important;
  align-items:flex-start!important;justify-content:center!important;gap:4px!important;
  padding:2px 12px!important;margin:0!important;
  background:transparent!important;border:0!important;border-left:1px solid rgba(159,181,205,.25)!important;
  border-radius:0!important;box-shadow:none!important;overflow:visible!important;text-align:left!important;
}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] :is(.fm27-roster-metric,.fm27-management-stat,.fm27-recruitment-stat,.fm27-camp-summary-metric) > span{color:var(--fm27-ctx-muted)!important;font-size:10px!important;font-weight:600!important;line-height:1.25!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] :is(.fm27-roster-metric,.fm27-management-stat,.fm27-recruitment-stat,.fm27-camp-summary-metric) > strong{color:var(--fm27-ctx-color)!important;font-size:.84rem!important;font-weight:775!important;line-height:1.25!important;white-space:normal!important;overflow-wrap:anywhere!important}
/* Composite summary groups from training camp and staff keep their original information. */
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] :is(.fm27-camp-summary-metrics,.fm27-staff-summary-metrics,.fm27-cp-summary){display:flex!important;flex-flow:row wrap!important;justify-content:flex-end!important;align-items:center!important;gap:6px!important;min-width:0!important;margin-left:auto!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] .fm27-cp-summary-item{border-left:1px solid rgba(159,181,205,.25)!important;padding:3px 12px!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] .fm27-cp-summary-item span{font-size:10px!important;color:var(--fm27-ctx-muted)!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] .fm27-cp-summary-item strong{font-size:.84rem!important;color:var(--fm27-ctx-color)!important}
/* Secondary: filters and tabs left, navigation / actions right. */
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] :is(.fm27-roster-controls,.fm27-r272529-controls,.fm27-r272523-filter,.fm27-r272511-markettools,.fm27-cp-tools-left,.fm27-cp-tools-right,.fm27-v69-command-right){min-width:0!important;display:flex!important;align-items:center!important;flex-wrap:wrap!important;gap:7px!important;max-width:100%!important}
body.fm27-unified-ui #contentArea .fm27-ui-controls-left,
body.fm27-unified-ui #contentArea [data-fm27-toolbar-left],
body.fm27-unified-ui #contentArea .fm27-ui-controls-right,
body.fm27-unified-ui #contentArea [data-fm27-toolbar-right]{display:flex!important;align-items:center!important;gap:7px!important;min-width:0!important;flex-wrap:wrap!important}
body.fm27-unified-ui #contentArea .fm27-ui-controls-left{margin-right:auto!important}
body.fm27-unified-ui #contentArea .fm27-ui-controls-right,
body.fm27-unified-ui #contentArea [data-fm27-toolbar-right]{margin-left:auto!important;justify-content:flex-end!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] :is(.fm27-r272523-tabs,.fm27-r272529-tabs,.fm27-r2718-league-modes,.fm27-r272511-markettypes,.fm27-training-tabbar,.fm27-staff-view-tabs,.fm27-r272511-tabs,.fm27-player-subnav){display:flex!important;align-items:center!important;flex-wrap:wrap!important;gap:7px!important;margin:0!important;min-width:0!important;background:transparent!important;border:0!important;box-shadow:none!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] :is(.fm27-r272523-filter,.fm27-r272529-controls,.fm27-r272511-markettools,.fm27-s2722-toolbar-ticket){margin-left:auto!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] :is(.fm27-r272523-action,.fm27-r272529-action,.fm27-r272511-reset,.fm27-r272511-barbutton,.fm27-roster-nav-action,.fm27-r272523-tab,.fm27-r272529-tab,.fm27-r2711-action,.fm27-s2722-toolbar-ticket,.fm27-management-secondary a,.fm27-recruitment-secondary a,.btn,.nav-link){
  border-radius:7px!important;font-size:.76rem!important;line-height:1.25!important;
  font-weight:675!important;min-height:30px!important;max-width:100%!important;
  padding:6px 10px!important;white-space:normal!important;
  border-color:var(--fm27-ctx-btn-border)!important;color:#e7effb!important;
  background:var(--fm27-ctx-btn)!important;box-shadow:none!important;
}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] :is(.is-active,.active,.nav-link.active){background:#235348!important;border-color:#6cc3aa!important;color:#fff!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] :is(.fm27-roster-nav-action,.fm27-r272529-action,.fm27-r272523-action,.btn):hover{background:#304762!important;border-color:#7b9eac!important;color:#fff!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] :is(.form-control,.form-select,input[type="search"],select){background:#121f34!important;color:#f0f6ff!important;border:1px solid #556880!important;border-radius:7px!important;min-height:32px!important;font-size:.76rem!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] :is(.form-control,input[type="search"])::placeholder{color:#b1bed1!important;opacity:1}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] .fm27-context-band-caption{display:none!important}
/* R27.34 hard constraint: roster search + positions always side by side. */
body.fm27-unified-ui #contentArea .fm27-cp-roster .fm27-cp-tools-left .fm27-roster-controls,
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] .fm27-ui-controls-left:has(.fm27-roster-search){flex-direction:row!important;flex-wrap:nowrap!important;width:auto!important;max-width:100%!important;min-width:0!important}
body.fm27-unified-ui #contentArea .fm27-roster-search{flex:1 1 190px!important;width:auto!important;min-width:95px!important;max-width:255px!important}
body.fm27-unified-ui #contentArea #fm27RosterPosition{flex:1 1 154px!important;min-width:105px!important;max-width:215px!important;width:auto!important}
/* Formation: original two rows and all original tactical widgets; no title or replacement controls. */
body.fm27-unified-ui #contentArea #fm27V69Toolbar[data-fm27-context-bar="primary"]{
  display:block!important;min-height:0!important;margin:2px 0 1px!important;
  padding:8px 11px!important;border-radius:9px 9px 0 0!important;
}
body.fm27-unified-ui #contentArea #fm27V69Toolbar .fm27-v69-primary{
  display:flex!important;align-items:center!important;justify-content:flex-start!important;
  flex-wrap:wrap!important;gap:10px!important;width:100%!important;background:none!important;box-shadow:none!important;
}
body.fm27-unified-ui #contentArea #fm27V69Toolbar .fm27-v69-wellness{margin-left:auto!important}
body.fm27-unified-ui #contentArea #fm27V69Secondary[data-fm27-context-bar="secondary"]{
  margin:0 0 12px!important;border-radius:0 0 9px 9px!important;border-top-color:#30445e!important;
}
body.fm27-unified-ui #contentArea #fm27V69Secondary .fm27-v69-command-right{margin-left:auto!important}
body.fm27-unified-ui #contentArea #fm27V69Toolbar .fm27-v69-formation-button,
body.fm27-unified-ui #contentArea #fm27V69Secondary .fm27-v69-fixture,
body.fm27-unified-ui #contentArea #fm27V69Secondary .btn-outline-light{background:#253a55!important;border-color:#576a85!important;color:#f1f6ff!important}
body.fm27-unified-ui #contentArea #fm27V69Toolbar .fm27-v69-switch{background:#233750!important;border-color:#506783!important;color:#ecf3ff!important}
body.fm27-unified-ui #contentArea #fm27V69Toolbar .fm27-v69-grade,
body.fm27-unified-ui #contentArea #fm27V69Secondary label{color:#e3edf9!important}
body.fm27-unified-ui #contentArea #fm27V69Secondary .fm27-v69-save{background:#6448b6!important;border-color:#977de2!important;color:#fff!important}
/* prevent original green family wrappers applying external colored shadows/margins */
body.fm27-unified-ui #contentArea :is(.fm27-management-bands,.fm27-recruitment-bands,.fm27-r272529-bands,.fm27-r272523-bands,.fm27-cp){
  max-width:none!important;width:100%!important;min-width:0!important;box-shadow:none!important;
  padding:0!important;margin:0 0 6px!important;gap:0!important;background:transparent!important;border:0!important;
}
/* Formatted context bars are the only design boundary; do not suppress content-level cards/modals. */
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] :is(.dropdown-menu,.modal,.fm27-v69-tip,.fm27-v69-shape-panel){background:#19273d;color:#f0f6ff;border:1px solid #526780;z-index:1200}
body.fm27-unified-ui #contentArea [data-fm27-context-bar] :is(button,a,input,select):focus-visible{outline:2px solid #b3a1ff!important;outline-offset:2px}
@media(max-width:800px){
  body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"]:not([hidden]){align-items:flex-start!important;padding:10px 12px!important}
  body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] :is(.fm27-roster-metric,.fm27-management-stat,.fm27-recruitment-stat,.fm27-camp-summary-metric){padding:3px 7px!important;min-width:88px!important}
  body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"]:not([hidden]){padding:7px 9px!important;gap:7px!important}
  body.fm27-unified-ui #contentArea .fm27-ui-controls-left,body.fm27-unified-ui #contentArea .fm27-ui-controls-right{max-width:100%!important}
}
@media(max-width:460px){
  body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"]:not([hidden]){gap:9px!important}
  body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] :is(.fm27-roster-metric,.fm27-management-stat,.fm27-recruitment-stat,.fm27-camp-summary-metric){min-width:78px!important;max-width:47%!important}
  body.fm27-unified-ui #contentArea .fm27-roster-search{min-width:95px!important;max-width:50%!important}
  body.fm27-unified-ui #contentArea #fm27RosterPosition{min-width:96px!important;max-width:50%!important}
  body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] .fm27-ui-controls-right{margin-left:0!important}
}

/* Full-width exceptions from original website themes: retain internal panel layouts. */
body.fm27-unified-ui #contentArea :is(.fm27-portal,.fm27-clubsite,.fm27-team-content,.fm27-p2-statistics){
  max-width:none!important;width:100%!important;min-width:0!important;margin-left:0!important;margin-right:0!important;
}
body.fm27-unified-ui #contentArea #fm27V69Secondary #fm27V69FreekickSlot select{
  background:#20314b!important;border-color:#526782!important;color:#eff6ff!important;
}
body.fm27-unified-ui #contentArea #fm27V69Toolbar .fm27-v69-info{
  color:#b8dfd5!important;
}
/* One semantic alignment policy on all old frontend toolbars:
   filters/selection LEFT, external navigation/actions RIGHT. */
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] :is(
 .fm27-r272511-markettools,.fm27-r272523-filter,form.fm27-r272529-controls,
 .fm27-r2718-league-picker,.fm27-r272511-watchsearch,.fm27-r272529-search
){margin-left:0!important;justify-content:flex-start!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] :is(
 .fm27-r272511-reset,.fm27-r2718-league-results,.fm27-r272529-controls:not(form),
 .fm27-r272523-action.ms-auto,.fm27-r272513-actions,.fm27-r2711-options-link
){margin-left:auto!important}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] .fm27-r272511-markettools{
  flex:1 1 auto!important;flex-wrap:wrap!important;
}

/* Non-destructive toolbar alignment: controller marks ONLY existing elements.
   Search/filter IDs and parent nodes never move, preserving external AJAX/listeners. */
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] .fm27-roster-controls{
  flex-direction:row!important;flex-wrap:wrap!important;align-items:center!important;justify-content:flex-start!important;
  width:auto!important;min-width:0!important;max-width:100%!important;gap:7px!important;
}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] .fm27-roster-controls>.fm27-ui-first-right-action{
  margin-left:auto!important;
}
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] .fm27-roster-search,
body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] #fm27RosterPosition{
  flex-shrink:1!important;
}
@media(max-width:480px){
 body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] .fm27-roster-search,
 body.fm27-unified-ui #contentArea [data-fm27-context-bar="secondary"] #fm27RosterPosition{
   flex:1 1 42%!important;min-width:100px!important;max-width:48%!important;
 }
}
/* Home manager dashboard extends layout's page_header, outside #contentArea. */
body.fm27-unified-ui .fm27-portal,
body.fm27-unified-ui #fm27-manager-portal{
  width:100%!important;max-width:none!important;min-width:0!important;margin-inline:0!important;
}
/* Left page identity, compact grouped metrics on the right (matching approved Kader). */
body.fm27-unified-ui #contentArea [data-fm27-context-bar="primary"] :is(
 .fm27-r272523-title,.fm27-r272529-title,.fm27-training-summary-title,
 .fm27-staff-summary-title,.fm27-camp-summary-title,
 .fm27-recruitment-kicker,.fm27-management-kicker
){margin-right:auto!important}
