/* Shared responsive safety layer for management screens. Loaded after page styles. */
html, body { max-width: 100%; overflow-x: clip; }
body { -webkit-text-size-adjust: 100%; }
*, *::before, *::after { min-width: 0; }
img, video, audio, canvas, svg { max-width: 100%; }
.btn, button, a[class*="btn"] { display:inline-flex; align-items:center; justify-content:center; gap:.45rem; line-height:1.2; text-align:center; }
.card, .glass-card, .panel, .header-card, .controls-row, .table-card { max-width:100%; overflow-wrap:anywhere; }
.table-responsive { max-width:100%; overflow-x:auto !important; overscroll-behavior-inline:contain; -webkit-overflow-scrolling:touch; border-radius:inherit; }
.table-responsive > table { width:100% !important; }
.dataTables_wrapper { width:100%; max-width:100%; }
.dataTables_wrapper .row { max-width:100%; margin-left:0; margin-right:0; }
.dataTables_scroll { width:100% !important; max-width:100% !important; overflow:hidden; }
.dataTables_scrollHead { width:100% !important; max-width:100% !important; overflow:hidden !important; }
.dataTables_scrollBody { width:100% !important; max-width:100% !important; overflow-x:auto !important; overflow-y:hidden !important; overscroll-behavior-inline:contain; -webkit-overflow-scrolling:touch; }
.dataTables_scrollBody::-webkit-scrollbar { height:8px; }
.dataTables_scrollBody::-webkit-scrollbar-track { background:#e9edf3; border-radius:999px; }
.dataTables_scrollBody::-webkit-scrollbar-thumb { background:#7b8798; border-radius:999px; }
.dataTables_scrollHeadInner { min-width:680px; }
.dataTables_scrollHeadInner > table, .dataTables_scrollBody > table { min-width:680px !important; width:100% !important; }
.dataTables_filter input, .dataTables_length select { min-height:40px; }
.dataTables_wrapper .dataTables_length label { display:inline-flex; align-items:center; gap:.5rem; margin:0; font-size:.875rem; font-weight:600; white-space:nowrap; }
.dataTables_wrapper .dataTables_length select { width:auto !important; min-width:70px; margin:0 !important; }
.dataTables_wrapper .dataTables_filter label { margin:0; font-size:.875rem; font-weight:600; }
.dataTables_wrapper .dataTables_filter input,
input[type="search"] { min-height:44px; border:1px solid #d7dde6 !important; border-radius:12px !important; background:#fff; padding:.65rem .85rem !important; box-shadow:none !important; }
.dataTables_wrapper .dataTables_filter input:focus,
input[type="search"]:focus { border-color:#64748b !important; box-shadow:0 0 0 3px rgba(100,116,139,.12) !important; outline:0; }
.dataTables_wrapper .dataTables_info { font-size:.875rem; font-weight:600; color:#475569; }
.dataTables_wrapper .dataTables_paginate { font-size:.875rem; }
.compact-empty-state { padding:2rem 1rem !important; min-height:220px; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.compact-empty-state .compact-empty-icon,
.compact-empty-icon { font-size:2.25rem !important; color:#22a879; margin-bottom:.75rem !important; }
.compact-empty-state h2,
.compact-empty-state h3,
.compact-empty-state h4 { margin:.15rem 0 .4rem; font-size:1.15rem !important; line-height:1.3; font-weight:700 !important; color:#243041 !important; }
.compact-empty-state p { margin:0; max-width:34rem; font-size:.9rem !important; line-height:1.5; font-weight:500; color:#64748b !important; }

@media (max-width:640px) {
  body { padding:10px !important; }
  .container, .container-fluid, .container-custom, .wrap { width:100% !important; max-width:100% !important; margin-inline:auto !important; padding-inline:0 !important; }
  .card, .glass-card, .panel, .header-card, .controls-row, .table-card { border-radius:16px !important; }
  .btn, button, a[class*="btn"] { min-height:42px; white-space:normal; }
  .dataTables_wrapper > .row:first-child, .dataTables_wrapper > .row:last-child,
  .dataTables_wrapper > .d-flex:first-child, .dataTables_wrapper > .d-flex:last-child { display:grid !important; grid-template-columns:minmax(0,1fr) !important; gap:.65rem !important; align-items:stretch !important; }
  .dataTables_length, .dataTables_filter, .dataTables_info, .dataTables_paginate { width:100% !important; float:none !important; text-align:left !important; }
  .dataTables_wrapper > .row:first-child > div,
  .dataTables_wrapper > .row:last-child > div,
  .dataTables_wrapper > .d-flex:first-child > div,
  .dataTables_wrapper > .d-flex:last-child > div { width:100% !important; max-width:100% !important; padding:0 !important; margin:0 !important; }
  .dataTables_wrapper .dataTables_length label {
    display:grid !important;
    grid-template-columns:max-content 74px max-content;
    align-items:center !important;
    justify-content:start !important;
    gap:.5rem !important;
    width:auto !important;
    white-space:nowrap !important;
    line-height:1.2 !important;
  }
  .dataTables_wrapper .dataTables_length select {
    width:74px !important;
    min-width:74px !important;
    height:44px !important;
  }
  .dataTables_filter { max-width:100% !important; overflow:hidden; }
  .dataTables_filter label { display:block !important; width:100% !important; max-width:100% !important; overflow:hidden; }
  .dataTables_filter input { display:block !important; box-sizing:border-box !important; width:100% !important; min-width:0 !important; max-width:100% !important; margin:.35rem 0 0 !important; font-size:.78rem !important; }
  .dataTables_paginate .pagination { justify-content:flex-start !important; flex-wrap:wrap; }
  table.dataTable { min-width:680px; }
  table.dataTable th,
  table.dataTable td,
  .table-responsive table th,
  .table-responsive table td {
    white-space:nowrap !important;
    overflow-wrap:normal !important;
    word-break:normal !important;
    hyphens:none !important;
    font-size:.74rem !important;
    line-height:1.2 !important;
    padding:.58rem .5rem !important;
  }
  table.dataTable thead th,
  .table-responsive table thead th {
    font-size:.69rem !important;
    letter-spacing:.015em !important;
  }
  table.dataTable .student-roll,
  .table-responsive .student-roll,
  table.dataTable .badge,
  .table-responsive table .badge {
    white-space:nowrap !important;
    font-size:.7rem !important;
  }
  table.dataTable td .btn-sm,
  .table-responsive table td .btn-sm {
    min-width:34px;
    min-height:34px;
    padding:.35rem .5rem !important;
  }
  .filter-bar, .controls-row { display:grid !important; grid-template-columns:1fr !important; gap:10px !important; }
  .filter-bar > *, .controls-row > * { width:100% !important; margin:0 !important; }
  .filter-bar select, .filter-bar input, .controls-row select, .controls-row input { width:100% !important; }
  .actions { display:grid !important; grid-template-columns:1fr !important; width:100%; }
  .actions > * { width:100%; }
  .header-action-group .btn-action-batch { height:auto !important; padding:9px 7px !important; font-size:.72rem; }
  .header-action-group .btn-action-batch span { display:inline !important; }
  .dataTables_scroll::after { content:'Swipe horizontally to view all columns'; display:block; margin-top:.5rem; color:#64748b; font-size:.75rem; font-weight:600; text-align:center; }
  .dataTables_wrapper > .row:first-child,
  .dataTables_wrapper > .d-flex:first-child { padding:.65rem !important; border:0; border-radius:12px; background:#f8fafc; }
  .dataTables_wrapper > .row:last-child { padding:.75rem 0 0 !important; }
  .compact-empty-state { min-height:180px; padding:1.5rem 1rem !important; }
  .compact-empty-state .compact-empty-icon,
  .compact-empty-icon { font-size:1.9rem !important; }

  /* Consistent compact scale for management/detail/outpass screens. */
  h1, .h1 { font-size:1.25rem !important; line-height:1.2 !important; }
  h2, .h2 { font-size:1.08rem !important; line-height:1.25 !important; }
  h3, .h3 { font-size:.98rem !important; line-height:1.3 !important; }
  .header-title, .card-title, .page-title { font-size:1.2rem !important; line-height:1.2 !important; }
  .header-subtitle, .text-muted, small, .small { font-size:.72rem !important; line-height:1.35 !important; }
  .glass-card, .main-card, .card-body, .table-card, .data-card { padding:12px !important; }
  .btn, .btn-custom, .btnx, button, a[class*="btn"] { min-height:38px !important; padding:7px 10px !important; font-size:.72rem !important; border-radius:10px !important; }
  .badge, .badge-pill, .pill, .stat-badge { font-size:.66rem !important; line-height:1.2 !important; }
  .form-control, .form-select, input, select, textarea { max-width:100%; font-size:.8rem !important; }
  .table-responsive, .tablebox { overflow-x:auto !important; -webkit-overflow-scrolling:touch; }
  .header-card, .glass-card.d-flex.justify-content-between { gap:10px !important; }
}

@media (min-width:641px) {
  .dataTables_wrapper > .row:first-child { align-items:end !important; }
  .dataTables_wrapper .dataTables_filter { text-align:right !important; }
  .dataTables_wrapper .dataTables_filter label { display:inline-block; min-width:280px; text-align:left; }
  .dataTables_wrapper .dataTables_filter input { display:block; width:100% !important; margin:.35rem 0 0 !important; }
}
