/* Taqwa Lab Square Monitor Responsive Edition | 2026-11-07 | UI ONLY
   Targets: 1024x768 (4:3), 1280x1024 (5:4), 1366x768 and ordinary desktops.
   Page data, URL handlers, printing and business calculations are unchanged.
*/
@media screen {
  html { -webkit-text-size-adjust:100%; }
  *, *::before, *::after { box-sizing:border-box; }
  body { width:100%; max-width:100%; }
  body .main, body .main.limited-main { min-width:0!important; }
  body .main img, body .main video, body .main svg { max-width:100%; }
  body .main form, body .main fieldset, body .main .panel,
  body .main .entry, body .main .content, body .main .card {
    min-width:0; max-width:100%;
  }
  body .main input, body .main select, body .main textarea { box-sizing:border-box; }
  body .main .mobile-table-scroll {
    max-width:100%!important; overflow-x:auto!important; overflow-y:hidden;
    scrollbar-width:thin; scrollbar-color:#91a8c1 #f1f5f9;
    -webkit-overflow-scrolling:touch;
  }
  body .main .mobile-table-scroll > table { max-width:none!important; }
  body .main .mobile-table-scroll th,
  body .main .mobile-table-scroll td { vertical-align:middle; }
  body .main .mobile-table-scroll td button,
  body .main .mobile-table-scroll td a { white-space:nowrap; }
  /* Preserve normal screen scrolling; do not clip rightmost table actions. */
  body .main, body .main.limited-main { overflow-x:auto!important; }
  body .main .stats, body .main .grid, body .main .quick,
  body .main .cash-grid, body .main .billing-main-grid { min-width:0!important; }
  body .main .stats > *,body .main .grid > *,body .main .cash-grid > *,
  body .main .billing-main-grid > * { min-width:0; }
  body .main .panel-head,body .main .hero-actions { flex-wrap:wrap; }
  body .main .topbar .brand { min-width:0; }
  body .main .brand h1 { white-space:normal!important;overflow-wrap:anywhere;line-height:1.18!important; }
  body .main button,body .main a[role="button"] { cursor:pointer; }
}
/* The 5:4 / 4:3 large square-monitor tier.  Keep the permanent menu compact. */
@media screen and (min-width:1161px) and (max-width:1400px){
  html body .sidebar:not(.limited-sidebar){width:192px!important;padding:10px 8px!important;overflow-y:auto!important;overflow-x:hidden!important;}
  html body .main:not(.limited-main){max-width:calc(100% - 192px)!important;width:calc(100% - 192px)!important;padding:10px!important;}
  html body .sidebar.limited-sidebar{width:214px!important;padding:12px 9px!important;overflow-y:auto!important;overflow-x:hidden!important;}
  html body .main.limited-main{max-width:calc(100% - 214px)!important;width:calc(100% - 214px)!important;padding:10px!important;}
  html body .sidebar.limited-sidebar a {font-size:13px!important;line-height:1.2!important;padding:9px 9px!important;margin:4px 0!important;min-height:35px!important;border-radius:8px!important;box-shadow:none!important;}
  html body .sidebar.limited-sidebar h2{font-size:16px!important;margin:0 0 8px!important;}
  html body .sidebar.limited-sidebar .menu-title{font-size:10px!important;margin:9px 0 5px!important;}
  html body .sidebar.limited-sidebar .side-info-box{padding:8px!important;margin-top:8px!important;}
  html body .sidebar.limited-sidebar .digital-clock{font-size:17px!important;}
  html body .sidebar.limited-sidebar .side-date-row{font-size:10px!important;gap:5px!important;padding:5px!important;}
  html body .main .topbar{padding:10px 12px!important;gap:8px!important;flex-wrap:wrap!important;}
  html body .main .brand h1{font-size:clamp(16px,1.5vw,21px)!important;}
  html body .main .stats {grid-template-columns:repeat(3,minmax(0,1fr))!important;}
  html body .main .quick {grid-template-columns:repeat(4,minmax(0,1fr))!important;}
  html body .main .cash-grid,html body .main .top-cash-grid{gap:8px!important;}
  html body .main .billing-main-grid{max-width:100%!important;}
  html body .main input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
  html body .main select,html body .main textarea{max-width:100%;min-width:0;}
}
/* Compact square monitors (1024x768), small laptop windows, browser at 125% zoom.
   Sidebar becomes a usable overlay instead of consuming 1/4 of screen. */
@media screen and (min-width:901px) and (max-width:1160px){
  html,html body{max-width:100%!important;overflow-x:hidden!important;}
  html body .app{display:block!important;width:100%!important;min-width:0!important;}
  html body .main,html body .main.limited-main{
    display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;
    margin:0!important;padding:56px 12px 14px!important;overflow-x:auto!important;
  }
  html body #mobileMenuBtn{display:inline-flex!important;align-items:center!important;justify-content:center!important;
    position:fixed!important;right:14px!important;top:8px!important;z-index:10050!important;
    min-width:96px!important;height:40px!important;background:#0b5fa5!important;color:#fff!important;
    border:0!important;border-radius:9px!important;padding:7px 12px!important;font:700 14px Cambria,Georgia,serif!important;
    box-shadow:0 6px 18px rgba(10,69,112,.22)!important;cursor:pointer!important;}
  html body #mobileMenuOverlay{display:block!important;position:fixed!important;inset:0!important;z-index:10010!important;
    background:rgba(2,18,35,.45)!important;opacity:0!important;visibility:hidden!important;
    pointer-events:none!important;transition:opacity .2s ease!important;}
  html body.mobile-menu-open #mobileMenuOverlay {opacity:1!important;visibility:visible!important;pointer-events:auto!important;}
  html body .sidebar,html body .sidebar.limited-sidebar{
    display:block!important;position:fixed!important;top:0!important;bottom:0!important;right:-350px!important;
    width:285px!important;max-width:86vw!important;height:100dvh!important;z-index:10030!important;
    padding:56px 10px 14px!important;overflow-y:auto!important;overflow-x:hidden!important;
    background:linear-gradient(180deg,#072c4f,#053a63)!important;box-shadow:-10px 0 30px rgba(0,0,0,.18)!important;
    transition:right .2s ease!important;
  }
  html body.mobile-menu-open .sidebar,html body.mobile-menu-open .sidebar.limited-sidebar{right:0!important;}
  html body.mobile-menu-open{overflow:hidden!important;}
  html body .sidebar.limited-sidebar a{font-size:14px!important;padding:10px 10px!important;margin:5px 0!important;min-height:40px!important;box-shadow:none!important;}
  html body .sidebar.limited-sidebar h2{font-size:19px!important;margin:0 0 9px!important;}
  html body .sidebar.limited-sidebar .menu-title{font-size:11px!important;margin:10px 0 5px!important;}
  html body .main .topbar{padding:11px 15px!important;flex-wrap:wrap!important;gap:9px!important;}
  html body .main .brand h1{font-size:20px!important;}
  html body .main .stats{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:8px!important;}
  html body .main .quick{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:8px!important;}
  html body .main .grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;}
  html body .main .billing-main-grid {max-width:100%!important;}
  html body .main .cash-grid,html body .main .top-cash-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;}
  html body .main .mobile-table-scroll{margin:0 0 8px!important;overflow-x:auto!important;}
  html body .main .mobile-table-scroll > table{width:max-content!important;min-width:640px!important;max-width:none!important;table-layout:auto!important;}
  html body .main .mobile-table-scroll th,html body .main .mobile-table-scroll td{white-space:nowrap!important;font-size:12px!important;padding:6px!important;}
  html body .main .top-cash-panel,html body .main .bill-info-panel,html body .main .panel{min-width:0!important;}
  html body .main input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
  html body .main select,html body .main textarea{max-width:100%!important;min-width:0!important;}
  html body .main .tq-newpatient-modal,html body .main .modal-content{max-height:calc(100dvh - 34px)!important;overflow-y:auto;}
}
/* Login screen: show both introduction and login form without needless stacking at 1024px. */
@media screen and (min-width:901px) and (max-width:1160px){
  html body .login-shell{display:grid!important;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr)!important;min-height:0!important;width:100%!important;}
  html body .login-shell > .brand-side, html body .login-shell > .login-side{min-width:0!important;min-height:0!important;padding:20px!important;}
  html body .login-main{width:100%!important;max-width:100%!important;margin:12px auto!important;padding:16px!important;}
  html body .services{gap:8px!important;}
  html body .health-script{font-size:clamp(18px,2.2vw,26px)!important;}
  html body .page{max-width:100%!important;}
  html body .taqwa-login-slideshow{height:140px!important;}
}
/* Square monitors: reduce unnecessary vertical waste but keep comfortable controls. */
@media screen and (min-width:901px) and (max-height:850px){
  html body .main .panel-head {margin-bottom:8px!important;}
  html body .main .hero{padding:12px 15px!important;}
  html body .main .panel,html body .main .topbar {border-radius:10px!important;}
  html body .main .stats{margin:8px 0!important;}
  html body .main .sidebar a{line-height:1.2;}
  html body .main .tq-newpatient-modal,html body [role="dialog"] {max-height:calc(100dvh - 20px);}
}
/* For very narrow screens the existing dedicated mobile rules remain authoritative.
   Only prevent content from being inaccessible. */
@media screen and (max-width:900px){
  html body .main .mobile-table-scroll{overflow-x:auto!important;}
  html body .main .mobile-table-scroll table{max-width:none!important;}
  html body .main .billing-main-grid, html body .main .top-cash-grid{min-width:0!important;}
  html body .main .sidebar{max-height:100dvh;}
}
/* Invoices and A4/A5 print layout must not pick up desktop responsive changes. */
@media print{
  #mobileMenuBtn,#mobileMenuOverlay{display:none!important;}
  html body .main,html body .main.limited-main{overflow:visible!important;max-width:100%!important;width:100%!important;margin:0!important;padding:0!important;}
  html body .sidebar,html body .sidebar.limited-sidebar{display:none!important;}
  html body .mobile-table-scroll{overflow:visible!important;}
}
