/* Ghariyah administration: responsive, presentation-only enhancements. */
@media (max-width: 760px) {
  html, body { width:100%; max-width:100%; overflow-x:clip; }
  main { width:100%; max-width:100%; margin:16px auto; padding:0 10px; }
  main > .card, #subscriptionsDashboard, #attendanceDashboard,
  #profilesDashboard, #usersDashboard, #storeDashboard, #details {
    max-width:100%; min-width:0; padding:14px !important;
  }
  header { padding:12px; gap:10px; }
  .brand, .headerActions { min-width:0; }
  .dashboard-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .dashboard-tabs button { width:100%; min-width:0; min-height:48px; padding:10px 7px;
    white-space:normal; overflow-wrap:anywhere; line-height:1.35; }
  /* Four subscription tabs: two-by-two on phones, one row on desktop. */
  #subscriptionsDashboard > .sub-actions:first-of-type {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px;
  }
  #subscriptionsDashboard > .sub-actions:first-of-type button {
    min-width:0; width:100%; min-height:52px; padding:9px 6px;
    white-space:normal; overflow-wrap:anywhere; line-height:1.35;
  }
  #subscriptionsDashboard .sub-stats { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  #subscriptionsDashboard .sub-stats .card { min-width:0; padding:12px; }
  #subscriptionsDashboard .sub-stats b { font-size:clamp(17px,5vw,23px); overflow-wrap:anywhere; }
  #subscriptionsDashboard .sub-actions { gap:8px; }
  #subscriptionsDashboard .sub-actions input[type=search] { flex:1 1 170px; width:100%; min-width:0; }
  #subMonthlyReport { padding:12px !important; min-width:0; }
  #subReportMonth { display:block; width:100%; max-width:100% !important; margin:8px 0 !important; }
  .tableWrap, .att-report-table, .sub-details { width:100%; max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .tableWrap table, .att-report-table table, .sub-details table { width:max-content; min-width:100%; }
  .tableWrap th, .tableWrap td, .att-report-table th, .att-report-table td,
  .sub-details th, .sub-details td { padding:10px 9px; }
  .sub-detail > td { padding:8px !important; }
  .sub-details { max-width:calc(100vw - 56px); }
  .sub-details .sub-actions button { min-height:46px; white-space:normal; }
  .att-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .att-tabs button { min-width:0; width:100%; min-height:48px; padding:9px 5px; white-space:normal; }
  .att-toolbar { align-items:stretch; }
  .att-toolbar label { flex:1 1 135px; min-width:0; }
  .att-toolbar label input, .att-toolbar label select { width:100%; max-width:100%; }
  .att-summary { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .att-summary span { min-width:0; overflow-wrap:anywhere; }
  .att-assignment { flex-wrap:wrap; }
  .att-assignment select { min-width:125px; max-width:100%; }
  .att-player { grid-template-columns:minmax(0,1fr); gap:9px; }
  .att-choices { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); width:100%; gap:6px; }
  .att-choice { width:100%; min-height:46px; padding:8px 3px; white-space:normal; }
  .gtc-users-grid { grid-template-columns:minmax(0,1fr); }
  .gtc-users-grid input, .gtc-users-grid select, .gtc-users-grid button { max-width:100%; }
  .profile-actions, .toolbar, .filters { gap:8px; }
  input, select, textarea { min-width:0; max-width:100%; font-size:16px !important; }
  button { touch-action:manipulation; }
}
@media (min-width:761px) and (max-width:1020px) {
  #subscriptionsDashboard > .sub-actions:first-of-type { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); }
  #subscriptionsDashboard > .sub-actions:first-of-type button { min-width:0; white-space:normal; }
}
/* Preserve all hidden sections regardless of responsive display rules. */
[hidden], .dashboard-tabs[hidden], #subscriptionsDashboard[hidden],
#attendanceDashboard[hidden], #subMonthlyReport[hidden],
#profilesDashboard[hidden], #usersDashboard[hidden], #storeDashboard[hidden] { display:none !important; }

/* Compact admin panels, no page-wide horizontal overflow */
html,body{max-width:100%;overflow-x:clip}
#gtcAdultsDashboard,#dashboard,#profilesDashboard,#subscriptionsDashboard{max-width:100%;min-width:0}
#gtcAdultsDashboard{padding-top:12px!important}
#gtcAdultsDashboard h2{margin-top:10px!important}
.gtc-adult-table-scroll,.sub-details{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
@media(max-width:800px){.dashboard-tabs,.gtc-adult-tabs{display:flex!important;flex-wrap:wrap!important;gap:8px!important}.dashboard-tabs button,.gtc-adult-tabs button{min-width:0;white-space:normal}.gtc-adult-stats,.gtc-adult-sub-stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}}


/* FINAL MOBILE NAV FIX — overrides older conflicting flex !important rules.
   Scope: mobile administration only; no application logic changes. */
@media screen and (max-width:800px) {
  #dashboardTabs.dashboard-tabs:not([hidden]) {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    grid-auto-flow:row !important;
    gap:10px !important;
    width:100% !important;
    max-width:100% !important;
    margin:14px 0 24px !important;
    align-items:stretch !important;
    justify-items:stretch !important;
    box-sizing:border-box !important;
  }
  #dashboardTabs.dashboard-tabs > button {
    box-sizing:border-box !important;
    display:flex !important;
    flex-direction:row !important;
    justify-content:center !important;
    align-items:center !important;
    flex-wrap:wrap !important;
    gap:9px !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    min-height:54px !important;
    padding:12px 16px !important;
    margin:0 !important;
    font-size:clamp(15px,4vw,18px) !important;
    line-height:1.5 !important;
    white-space:normal !important;
    overflow-wrap:normal !important;
    word-break:normal !important;
    hyphens:none !important;
    text-align:center !important;
    border-radius:12px !important;
  }
  #dashboardTabs .gtc-notice-count:not([hidden]) {
    position:static !important;
    inset:auto !important;
    transform:none !important;
    flex:0 0 auto !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    min-width:25px !important;
    height:25px !important;
    margin:0 !important;
    padding:2px 7px !important;
    font-size:13px !important;
    line-height:1 !important;
    border-radius:30px !important;
  }
  #gtcProgramReturn {max-width:100%;margin:12px 0 16px !important;}
  #gtcBackPrograms {
    font-size:14px !important;
    line-height:1.4 !important;
    padding:10px 14px !important;
    min-height:42px !important;
    max-width:100% !important;
    color:#28231b !important;
    background:#fff !important;
    border:1px solid #d7c28c !important;
    border-radius:10px !important;
    white-space:normal !important;
  }
  .stats,.store-stats,.sub-stats,.gtc-adult-sub-stats {
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:10px !important;
  }
  #dashboardTabs[hidden],.dashboard-tabs[hidden] {display:none !important;}
}
