/* ================================================================
   ALL SAINTS SCHOOL — mobile.css  (phones & small tablets)
   Loaded after style.css. Desktop is untouched.
   ================================================================ */
.mobile-topbar,.nav-overlay{display:none}
.top-back{margin-bottom:14px}

@media (max-width:900px){
  html,body{overflow-x:hidden;max-width:100%}
  body{display:block}
  .top-back{display:none}
  .tb-back{display:flex;align-items:center;justify-content:center;width:42px;height:42px;border-radius:10px;
    background:rgba(255,255,255,.12);color:#fff;text-decoration:none;font-size:22px;font-weight:900;flex-shrink:0}
  .tb-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .main-wrap{min-width:0;max-width:100vw;overflow-x:hidden}
  .card{max-width:100%}
  .card-body{overflow-x:auto}
  .card-body[style*="display:flex"]{flex-wrap:wrap}
  [style*="grid-template-columns"]{grid-template-columns:1fr !important}
  img{max-width:100%;height:auto}

  /* top bar */
  .mobile-topbar{
    display:flex;align-items:center;gap:12px;position:fixed;top:0;left:0;right:0;height:56px;
    background:var(--navy);color:#fff;padding:0 12px;z-index:250;box-shadow:0 2px 10px rgba(0,0,0,.25);
  }
  .mobile-topbar button{background:rgba(255,255,255,.12);border:none;color:#fff;font-size:22px;
    width:42px;height:42px;border-radius:10px;cursor:pointer;line-height:1}
  .tb-title{font-weight:900;font-size:16px;color:var(--gold-lt);line-height:1.1}
  .tb-title small{display:block;font-size:10px;font-weight:600;color:rgba(255,255,255,.55);letter-spacing:1px;text-transform:uppercase}

  /* off-canvas sidebar */
  .sidebar{width:280px;max-width:84vw;transform:translateX(-102%);transition:transform .25s ease;
    z-index:300;box-shadow:6px 0 24px rgba(0,0,0,.35);overflow-y:auto}
  body.nav-open .sidebar{transform:none}
  .nav-overlay{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:290;
    opacity:0;pointer-events:none;transition:opacity .25s;display:block}
  body.nav-open .nav-overlay{opacity:1;pointer-events:auto}
  .sidebar-nav a{padding:13px 14px;font-size:14px}
  .sidebar-foot a{padding:12px 14px;font-size:14px}

  .main-wrap{margin-left:0;padding:70px 12px 90px;min-height:100vh;width:100%}
  .page-title{font-size:20px}
  .page-header{margin-bottom:14px}
  .card-body{padding:14px}
  .card-head{padding:12px 14px;flex-wrap:wrap;gap:8px}
  .stats-row{grid-template-columns:1fr 1fr;gap:10px}

  /* forms: big tap targets, 16px stops iOS zoom */
  input,select,textarea{font-size:16px !important;min-height:46px;padding:10px 12px}
  textarea{min-height:90px}
  .btn{min-height:44px;padding:10px 16px;font-size:14px}
  .btn-sm{min-height:42px;padding:9px 14px;font-size:13px}
  .form-grid,.form-grid-3{grid-template-columns:1fr}
  .form-actions{flex-direction:column}
  .form-actions .btn{width:100%;justify-content:center}

  /* tabs scroll sideways instead of overflowing */
  .tabs-bar{overflow-x:auto;white-space:nowrap;flex-wrap:nowrap !important;-webkit-overflow-scrolling:touch}
  .tabs-bar > a{flex:0 0 auto;padding:12px 16px !important}
  .tabs-bar > div{flex:0 0 auto !important;margin-left:auto;padding-left:10px}

  /* ── list tables → cards ── */
  .tbl-scroll{overflow-x:visible}
  table.resp thead{display:none}
  table.resp,table.resp tbody,table.resp tr,table.resp td{display:block;width:100%}
  table.resp tr{background:#fff;border:1px solid var(--border) !important;border-radius:12px;margin:0 0 12px;padding:8px 12px;box-shadow:var(--shadow)}
  table.resp td{display:flex;justify-content:space-between;align-items:center;gap:12px;
    padding:8px 0 !important;border:none !important;text-align:right;font-size:14px}
  table.resp td::before{content:attr(data-label);font-family:'JetBrains Mono',monospace;font-size:10px;
    letter-spacing:1px;text-transform:uppercase;color:var(--muted);text-align:left;flex-shrink:0}
  table.resp td[data-label=""]::before,table.resp td.act::before,table.resp td[colspan]::before{display:none}
  table.resp td[colspan]{display:block;text-align:center}
  table.resp td.act{flex-wrap:wrap;justify-content:stretch;gap:8px;padding-top:10px !important;
    border-top:1px dashed var(--border) !important;margin-top:4px}
  table.resp td.act .btn,table.resp td.act .rpt-btn,table.resp td.act a{flex:1 1 42%;justify-content:center;text-align:center;min-height:44px;
    display:inline-flex;align-items:center}
  table.resp td.act form{flex:1 1 42%;display:flex !important}
  table.resp td.act form .btn{width:100%}

  /* ── marks entry: one card per subject ── */
  table.marks-tbl tr{display:grid;grid-template-columns:1fr 1fr;gap:10px 12px;padding:12px}
  table.marks-tbl td{display:block;text-align:left;padding:0 !important}
  table.marks-tbl td::before{display:block;margin-bottom:4px}
  table.marks-tbl td:nth-child(1){display:none}
  table.marks-tbl td:nth-child(2){grid-column:1/-1;font-size:17px;font-weight:900;
    border-bottom:1px solid var(--border) !important;padding-bottom:8px !important}
  table.marks-tbl td:nth-child(2)::before{display:none}
  table.marks-tbl .ml-chip{width:100%;height:50px;font-size:18px}
  table.marks-tbl .mark-inp{width:100% !important;height:50px;font-size:20px !important;text-align:center;padding:6px !important}
  table.marks-tbl td.calc-cell{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;
    background:rgba(26,47,122,.06);border-radius:8px;padding:8px 12px !important}
  table.marks-tbl td.calc-cell::before{margin:0}
  table.marks-tbl td:last-child{grid-column:1/-1;display:flex;justify-content:space-between;
    align-items:center;font-size:18px}
  table.marks-tbl td:last-child::before{margin:0}

  /* ── activity / attendance / grade tables stay tables, just fit ── */
  .sc-tbl th,.sc-tbl td{padding:8px 6px;font-size:13px}
  .sc-tbl th{width:auto !important}
  .sc-tbl td:first-child{width:44%}
  .sc-tbl .grd-sel,.sc-tbl select{width:100% !important;min-height:44px;padding:6px 4px !important;font-size:16px !important}
  .sc-tbl input[type=number]{width:100% !important}

  /* ── Save / Lock bar sticks to the bottom of the screen ── */
  .action-bar{position:fixed;left:0;right:0;bottom:0;z-index:120;background:#fff;
    border-top:1px solid var(--border);padding:10px 12px !important;margin:0 !important;
    box-shadow:0 -4px 14px rgba(0,0,0,.12);flex-wrap:nowrap !important;gap:8px !important}
  .action-bar form{flex:1;display:flex !important}
  .action-bar .btn{flex:1;width:100%;justify-content:center;min-height:48px;font-size:14px}
  .action-bar > span{flex:1;text-align:center;font-size:13px}

  /* public result page */
  .public-hero{padding:22px 14px 16px}
  .public-body{padding:14px}
}

@media (max-width:420px){
  .stats-row{grid-template-columns:1fr}
  .page-title{font-size:18px}
}
