/* SCMWIS — Responsive rules and reduced motion */
/* ---------- Responsive ---------- */
@media (max-width:1100px){
  .dash-wrap{flex-direction:column;}
  .dash-left{width:100%;flex:none;flex-direction:row;flex-wrap:wrap;}
  .dash-left .donut-card{flex:1 1 280px;}
}
@media (max-width:900px){
  .landing-stage{padding:24px 0;}
  .landing{padding:0 12px;}
  /* Sidebar becomes a slide-in drawer (opened with the hamburger button) instead of a bar on top */
  .admin.show{flex-direction:row;}
  .sidebar{position:fixed;top:0;left:0;bottom:0;z-index:100;width:250px;max-width:82vw;flex:none;height:100vh;flex-direction:column;overflow-y:auto;padding:10px 8px 14px;border-right:1px solid var(--line);box-shadow:var(--shadow-pop);transition:transform .2s ease;}
  .sidebar.collapsed{display:flex;width:250px;max-width:82vw;padding:10px 8px 14px;overflow-y:auto;transform:translateX(-105%);visibility:hidden;box-shadow:none;border-right:1px solid var(--line);}
  .sidebar-brand{display:flex;}
  .admin.show:has(.sidebar:not(.collapsed))::before{content:"";position:fixed;inset:0;background:rgba(16,24,40,.45);z-index:90;}
  .nav-item{white-space:normal;margin:0 0 1px 0;padding:11px 12px;}
  .main{width:100%;}
  /* Tables scroll sideways inside their card instead of being cut off */
  .content .panel{overflow-x:auto;-webkit-overflow-scrolling:touch;}
  .content .panel table{min-width:640px;}
  .panel-head{padding:12px 14px;}
  .filters{width:100%;}
  .filters input,.filters select{min-width:0;flex:1 1 140px;}
  .notif-panel{position:fixed;top:52px;left:12px;right:12px;width:auto;max-width:none;}
  .role-chip{display:none;}
  .topbar{padding:0 14px;}
  .user-chip{display:none;}
  .content{padding:18px 14px 32px;}
  .row2{flex-direction:column;}
  .report-doc{padding:24px 20px;}
}
@media (prefers-reduced-motion:reduce){
  *{transition:none !important;animation:none !important;}
}

button.text-link{background:none;border:none;padding:0;font:inherit;font-weight:600;color:var(--accent);}

/* ============================================================
   Whole-system responsive refinements (tablet + phone)
   ============================================================ */
html{-webkit-text-size-adjust:100%;}
img,video,canvas{max-width:100%;}

/* Dashboard: stack the charts above the tables (the fixed 340px column used to become a 340px-TALL box) */
@media (max-width:1100px){
  .dash-wrap.dash-wrap{flex-direction:column;padding:10px;}
  .dash-wrap .dash-left{width:100%;flex:none;flex-direction:row;flex-wrap:wrap;padding-right:0;padding-bottom:12px;gap:12px;}
  .dash-wrap .dash-left .donut-card{flex:1 1 260px;min-width:0;}
  .dash-wrap .dash-right{border-left:none;border-top:1px solid var(--line);padding:12px;}
}

/* Wide tables scroll sideways inside their card; soft edge shadows show that there is more to swipe */
@media (max-width:900px){
  .content .panel{
    background-color:var(--surface);
    background-image:linear-gradient(to right,var(--surface) 30%,rgba(255,255,255,0)),linear-gradient(to left,var(--surface) 30%,rgba(255,255,255,0)),radial-gradient(farthest-side at 0 50%,rgba(0,0,0,.16),rgba(0,0,0,0)),radial-gradient(farthest-side at 100% 50%,rgba(0,0,0,.16),rgba(0,0,0,0));
    background-repeat:no-repeat;
    background-size:36px 100%,36px 100%,12px 100%,12px 100%;
    background-position:left center,right center,left center,right center;
    background-attachment:local,local,scroll,scroll;
  }
  .content .panel .panel-head{position:sticky;left:0;}
  .modal table{display:block;max-width:100%;overflow-x:auto;}
}

@media (max-width:640px){
  .content{padding:14px 12px 28px;}
  .content h2{font-size:18px;}
  .panel-head{padding:12px;}
  .filters input{min-width:0;flex:1 1 100%;}
  .filters select{flex:1 1 calc(50% - 8px);}
  .filters .btn{flex:1 1 auto;}
  .modal-overlay{padding:10px;}
  .modal{padding:18px;max-height:92vh;}
  .modal-actions{bottom:-18px;margin-bottom:-18px;padding:12px 0 18px;}
  .modal-actions .btn{flex:1 1 100%;}
  .topbar{gap:8px;}
  .dash-wrap .dash-left .donut-card{flex:1 1 100%;}
  .dash-wrap .donut{width:180px;height:180px;}
  .dash-wrap .donut-hole{width:124px;height:124px;}
}