/* MML v4.20.7.1 — Dashboard + Mobile UX
   Responsive presentation only.
   Desktop layout and auction/business logic remain unchanged. */

@media (max-width: 760px){

  /* ---------- Global mobile safety ---------- */
  html,body{max-width:100%;overflow-x:hidden}
  #page,.beta-content,.main-content,.content-shell{min-width:0!important;max-width:100%!important}
  button,input,select,textarea{max-width:100%}
  button,.primary,.secondary,.ghost{touch-action:manipulation}

  /* ---------- Dashboard ---------- */
  .dashboard-v41008{
    gap:8px!important;
    min-width:0!important;
  }

  /* Keep the manager / club identity visible, but compact. */
  .dashboard-v41008 .d8-command{
    display:grid!important;
    grid-template-columns:1fr!important;
    min-height:0!important;
    padding:10px!important;
    gap:8px!important;
  }
  .dashboard-v41008 .d8-manager{
    min-width:0!important;
    width:100%!important;
  }
  .dashboard-v41008 .d8-manager>div:last-child{min-width:0!important}
  .dashboard-v41008 .d8-manager h1{
    font-size:18px!important;
    line-height:1.05!important;
    overflow-wrap:anywhere;
  }

  /* Top KPI rows become finger-friendly horizontal snap strips.
     Desktop remains exactly as before because these rules only apply <=760px. */
  .dashboard-v41008 .d8-stat-strip,
  .dashboard-v41008 .d8-finance-strip{
    display:flex!important;
    flex-wrap:nowrap!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    gap:8px!important;
    padding:8px!important;
    scroll-snap-type:x proximity;
    scrollbar-width:thin;
    -webkit-overflow-scrolling:touch;
  }
  .dashboard-v41008 .d8-stat,
  .dashboard-v41008 .d8-finance-kpi{
    flex:0 0 min(78vw,245px)!important;
    min-width:min(78vw,245px)!important;
    max-width:min(78vw,245px)!important;
    min-height:78px!important;
    border:1px solid var(--dash-line)!important;
    border-radius:8px!important;
    scroll-snap-align:start;
    padding:11px 12px!important;
  }
  .dashboard-v41008 .d8-stat+.d8-stat,
  .dashboard-v41008 .d8-finance-kpi+.d8-finance-kpi{
    border-left:1px solid var(--dash-line)!important;
  }
  .dashboard-v41008 .d8-stat b,
  .dashboard-v41008 .d8-finance-kpi b{
    overflow-wrap:anywhere;
  }

  /* Timeline stays horizontally swipeable rather than crushing cards. */
  .dashboard-v41008 .d8-timeline{
    grid-template-columns:repeat(7,minmax(150px,78vw))!important;
    gap:12px!important;
    scroll-snap-type:x proximity;
    -webkit-overflow-scrolling:touch;
  }
  .dashboard-v41008 .d8-stage{scroll-snap-align:start}

  .dashboard-v41008 .d8-bottom{
    grid-template-columns:1fr!important;
    gap:8px!important;
  }
  .dashboard-v41008 .d8-breakdown-row{
    gap:10px!important;
  }
  .dashboard-v41008 .d8-breakdown-row span{
    min-width:0!important;
    overflow-wrap:anywhere;
  }

  /* Dashboard auction cockpit remains one-tap accessible. */
  .auction-cockpit-v4141{
    min-height:56px!important;
    width:100%!important;
    grid-template-columns:1fr!important;
    gap:3px!important;
    padding:11px 12px!important;
  }
  .auction-cockpit-v4141 strong{
    justify-self:start!important;
  }

  /* ---------- Live Auction: priority mobile experience ---------- */
  .au414{
    gap:10px!important;
    min-width:0!important;
  }
  .au414-head{
    grid-template-columns:1fr!important;
    gap:8px!important;
  }
  .au414-title h2{font-size:22px!important}
  .au414-title p{font-size:12px!important}
  .au414-leading{
    min-width:0!important;
    width:100%!important;
    padding:10px 12px!important;
  }
  .au414-list-btn{
    width:100%!important;
    min-height:44px!important;
  }

  .au414-search-row{
    grid-template-columns:1fr!important;
    gap:8px!important;
  }
  .au414-search input,
  .au414-day-select{
    width:100%!important;
    min-width:0!important;
    min-height:44px!important;
  }

  .au414-day-strip{
    margin-inline:-2px;
    padding-bottom:6px!important;
    scroll-snap-type:x proximity;
  }
  .au414-day{
    min-height:44px!important;
    scroll-snap-align:start;
  }

  /* Metrics: swipe instead of four tall stacked boxes. */
  .au414-metrics{
    display:flex!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    gap:8px!important;
    padding:8px!important;
    border-radius:8px!important;
    scroll-snap-type:x proximity;
    -webkit-overflow-scrolling:touch;
  }
  .au414-metric{
    flex:0 0 min(76vw,235px)!important;
    min-width:min(76vw,235px)!important;
    border:1px solid var(--au-line)!important;
    border-radius:7px!important;
    padding:10px!important;
    scroll-snap-align:start;
  }

  /* Sort/filter controls are reachable by a single horizontal swipe. */
  .au414-controls{
    overflow-x:auto!important;
    overflow-y:hidden!important;
    flex-wrap:nowrap!important;
    gap:6px!important;
    padding:7px!important;
    -webkit-overflow-scrolling:touch;
  }
  .au414-controls>span:first-child{display:none}
  .au414-controls .spacer{display:none}
  .au414-controls button{
    flex:0 0 auto!important;
    min-height:42px!important;
    white-space:nowrap!important;
    padding:8px 11px!important;
  }

  /* Convert the wide auction table to compact mobile auction cards.
     The underlying markup, event handlers, inputs, timers and bid buttons stay unchanged. */
  .au414-table-wrap{
    overflow:visible!important;
    border:0!important;
    background:transparent!important;
  }
  .au414-table{
    display:block!important;
    min-width:0!important;
    width:100%!important;
  }
  .au414-table thead{display:none!important}
  .au414-table tbody{
    display:grid!important;
    gap:10px!important;
    width:100%!important;
  }
  .au414-table tbody tr[data-au414-id]{
    position:relative;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:0 10px;
    width:100%!important;
    min-width:0!important;
    border:1px solid var(--au-line);
    border-radius:10px;
    overflow:hidden;
    background:#0a1419;
    padding:10px;
  }
  .au414-table tbody tr.is-fav{
    border-color:rgba(255,199,62,.6)!important;
    background:linear-gradient(135deg,rgba(255,194,49,.08),#0a1419 48%)!important;
  }
  .au414-table tbody tr.is-own{opacity:.8}

  .au414-table tbody tr[data-au414-id]>td{
    display:block!important;
    min-width:0!important;
    width:auto!important;
    border:0!important;
    padding:7px 0!important;
    font-size:12px!important;
  }

  /* Favourite: always reachable at top-right. */
  .au414-table tbody tr[data-au414-id]>td:nth-child(1){
    position:absolute;
    top:8px;
    right:8px;
    z-index:2;
    padding:0!important;
  }
  .au414-fav{
    width:44px!important;
    height:44px!important;
    display:grid!important;
    place-items:center!important;
    font-size:25px!important;
    border-radius:8px!important;
  }

  /* Player identity occupies the full card width and leaves room for star. */
  .au414-table tbody tr[data-au414-id]>td:nth-child(2){
    grid-column:1/-1;
    padding-right:50px!important;
    padding-bottom:10px!important;
    border-bottom:1px solid var(--au-line)!important;
  }
  .au414-player{
    min-width:0!important;
    width:100%!important;
  }
  .au414-avatar{
    width:42px!important;
    height:42px!important;
    flex:0 0 42px;
  }
  .au414-player>div{min-width:0}
  .au414-player b{
    font-size:14px!important;
    overflow-wrap:anywhere;
  }

  /* OVR / Pos / Age compact row. */
  .au414-table tbody tr[data-au414-id]>td:nth-child(3),
  .au414-table tbody tr[data-au414-id]>td:nth-child(4),
  .au414-table tbody tr[data-au414-id]>td:nth-child(5){
    grid-column:auto;
  }
  .au414-table tbody tr[data-au414-id]>td:nth-child(3)::before{content:"OVR";display:block}
  .au414-table tbody tr[data-au414-id]>td:nth-child(4)::before{content:"Position";display:block}
  .au414-table tbody tr[data-au414-id]>td:nth-child(5)::before{content:"Age";display:block}
  .au414-table tbody tr[data-au414-id]>td:nth-child(3)::before,
  .au414-table tbody tr[data-au414-id]>td:nth-child(4)::before,
  .au414-table tbody tr[data-au414-id]>td:nth-child(5)::before,
  .au414-table tbody tr[data-au414-id]>td:nth-child(6)::before,
  .au414-table tbody tr[data-au414-id]>td:nth-child(7)::before,
  .au414-table tbody tr[data-au414-id]>td:nth-child(8)::before,
  .au414-table tbody tr[data-au414-id]>td:nth-child(9)::before{
    color:#7f929b;
    font-size:9px;
    line-height:1;
    text-transform:uppercase;
    letter-spacing:.05em;
    margin-bottom:4px;
  }

  /* Current bid + timer are the two most important read-only values. */
  .au414-table tbody tr[data-au414-id]>td:nth-child(6){
    grid-column:1/2;
    border-top:1px solid var(--au-line)!important;
    margin-top:4px;
    padding-top:10px!important;
  }
  .au414-table tbody tr[data-au414-id]>td:nth-child(6)::before{content:"Current bid"}
  .au414-table tbody tr[data-au414-id]>td:nth-child(8){
    grid-column:2/3;
    border-top:1px solid var(--au-line)!important;
    margin-top:4px;
    padding-top:10px!important;
  }
  .au414-table tbody tr[data-au414-id]>td:nth-child(8)::before{content:"Deadline"}
  .au414-bid strong{font-size:16px!important}
  .au414-timer{
    display:inline-block!important;
    font-size:17px!important;
  }

  /* Highest bidder gets its own row. */
  .au414-table tbody tr[data-au414-id]>td:nth-child(7){
    grid-column:1/-1;
  }
  .au414-table tbody tr[data-au414-id]>td:nth-child(7)::before{content:"Highest bidder"}
  .au414-leader{
    min-width:0!important;
    width:100%!important;
  }

  /* Bid amount is full width and immediately followed by the two actions. */
  .au414-table tbody tr[data-au414-id]>td:nth-child(9){
    grid-column:1/-1;
    padding-top:10px!important;
    border-top:1px solid var(--au-line)!important;
  }
  .au414-table tbody tr[data-au414-id]>td:nth-child(9)::before{content:"Your bid"}
  .au414-input{
    width:100%!important;
    min-height:46px!important;
    font-size:16px!important; /* prevents iOS zoom */
    text-align:left!important;
  }

  .au414-table tbody tr[data-au414-id]>td:nth-child(10),
  .au414-table tbody tr[data-au414-id]>td:nth-child(11){
    padding:3px 0 0!important;
  }
  .au414-quick,.au414-mail{
    width:100%!important;
    min-height:46px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    font-size:13px!important;
  }
  .au414-mail::after{content:" Direct bid";margin-left:5px}

  .au414-admin-row{
    margin-top:8px!important;
  }
  .au414-admin-row button{
    min-height:40px!important;
    padding:8px 10px!important;
  }

  .au414-bottom{
    grid-template-columns:1fr!important;
    gap:8px!important;
  }
  .au414-help{padding:11px!important}
  .au414-footer{
    display:grid!important;
    gap:4px!important;
  }

  /* Dialogs: keep confirm / nomination actions fully visible. */
  .au414-modal{
    width:calc(100vw - 16px)!important;
    max-width:none!important;
    max-height:92dvh!important;
    margin:auto!important;
  }
  .au414-modal-head{
    padding:12px!important;
  }
  .au414-modal-head button{
    min-width:44px!important;
    min-height:44px!important;
  }
  .au414-modal-body{
    padding:12px!important;
    max-height:calc(92dvh - 70px)!important;
  }
  .au414-modal-body input,
  .au414-modal-body select,
  .au414-modal-body button{
    min-height:44px;
  }
  .au414-budget-box{
    grid-template-columns:minmax(0,1fr) auto!important;
    gap:8px!important;
  }
  .au414-budget-box b{
    overflow-wrap:anywhere;
  }

  /* ---------- Generic dashboard tables ---------- */
  .dashboard-v41008 table,
  .transfer-center-v450 table{
    max-width:100%;
  }
}

@media (max-width: 420px){
  .dashboard-v41008 .d8-stat,
  .dashboard-v41008 .d8-finance-kpi{
    flex-basis:86vw!important;
    min-width:86vw!important;
    max-width:86vw!important;
  }
  .au414-metric{
    flex-basis:84vw!important;
    min-width:84vw!important;
  }
  .au414-table tbody tr[data-au414-id]{
    grid-template-columns:1fr 1fr!important;
    padding:9px!important;
  }
  .au414-table tbody tr[data-au414-id]>td:nth-child(3),
  .au414-table tbody tr[data-au414-id]>td:nth-child(4),
  .au414-table tbody tr[data-au414-id]>td:nth-child(5){
    font-size:11px!important;
  }
}
