/*
  Stable desktop layout for the admin cabinet.
  Desktop keeps the familiar cabinet proportions, while small laptop screens
  adapt instead of stretching the whole site to a giant 1536px canvas.
*/
:root{--taxichi-admin-width:1180px;--taxichi-sidebar-width:250px}
html{min-width:0;overflow-x:auto;background:#f4f5f6}
body{min-width:0;overflow-x:auto}
aside{width:var(--taxichi-sidebar-width)!important;padding:24px 18px!important}
main{margin-left:var(--taxichi-sidebar-width)!important;width:calc(100vw - var(--taxichi-sidebar-width))!important;min-height:100vh;padding:34px 42px!important;max-width:calc(100% - var(--taxichi-sidebar-width))}
.brand span,.brand-copy,nav button,.user{font-size:inherit!important}
.brand{margin-bottom:36px!important}
nav button{display:flex!important;align-items:center;padding:13px 14px!important;border-radius:12px!important;font-size:15px!important}
.user{display:grid!important}
header{gap:18px}
h1{font-size:30px!important}
.stats{grid-template-columns:repeat(4,1fr)!important;gap:16px!important;margin:28px 0!important}
.stats article{padding:21px!important}
.stats strong{font-size:30px!important}
.toolbar{padding:18px!important}
.panel{border-radius:17px!important}
table{min-width:1080px}
th,td{padding:16px 18px!important}
th:nth-child(3),td:nth-child(3){display:table-cell!important}
.driver-person{min-width:230px}
.driver-cell{min-width:170px}
.org-cell b{max-width:420px!important}
.driver-actions{display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:7px!important;flex-wrap:nowrap!important;min-width:360px}
.driver-actions button,.driver-waybill,.open,.actions button{white-space:nowrap}
.admin-balance-widget{flex:0 0 auto}
.admin-balance-widget span{max-width:150px;overflow:hidden;text-overflow:ellipsis}
.vehicle-docs{grid-template-columns:repeat(3,minmax(120px,1fr))!important}
.form-grid{grid-template-columns:1fr 1fr!important}
.details{grid-template-columns:1fr 1fr!important}
dialog{max-height:90vh;overflow:auto}
.wide{width:min(900px,calc(100vw - 70px))}

@media(max-width:1180px){
  main{padding:28px 24px!important}
  .stats{grid-template-columns:repeat(2,minmax(180px,1fr))!important}
  .toolbar{gap:12px!important}
  .panel{overflow-x:auto!important}
  table{min-width:980px!important}
  .driver-actions{min-width:300px}
}

@media(max-width:1180px) and (min-width:761px){
  :root{--taxichi-sidebar-width:210px!important}
  aside{width:210px!important;padding:18px 14px!important}
  main{margin-left:210px!important;width:calc(100vw - 210px)!important;max-width:calc(100% - 210px)!important;padding:22px 20px!important}
  .brand{margin-bottom:22px!important}
  .brand-copy b{font-size:18px!important}
  .brand-copy small{font-size:11px!important}
  nav button{padding:10px 11px!important;font-size:13px!important;border-radius:10px!important}
  .nav-icon{width:25px!important;height:25px!important;flex-basis:25px!important;margin-right:8px!important}
  h1{font-size:26px!important}
  header p{font-size:13px!important;margin:5px 0 0!important}
  .stats article{padding:15px!important}
  .stats strong{font-size:24px!important}
  table{min-width:860px!important}
  th,td{padding:11px 12px!important}
  .driver-person{min-width:180px!important}
  .driver-cell{min-width:135px!important}
  .driver-actions{min-width:260px!important;gap:5px!important}
  .driver-actions button,.driver-waybill,.open{padding:8px 10px!important;font-size:13px!important}
  .admin-balance-widget span{max-width:120px!important}
  .wide{width:min(820px,calc(100vw - 44px))!important}
}

@media(max-width:900px) and (min-width:761px){
  :root{--taxichi-sidebar-width:82px!important}
  aside{width:82px!important;padding:16px 10px!important}
  main{margin-left:82px!important;width:calc(100vw - 82px)!important;max-width:calc(100% - 82px)!important;padding:18px 16px!important}
  .brand{justify-content:center!important;margin-bottom:18px!important}
  .brand-copy,.user b,.user small{display:none!important}
  nav button{justify-content:center!important;padding:10px 8px!important;min-height:44px!important;font-size:0!important}
  nav button .nav-icon,.report-link .nav-icon{margin-right:0!important}
  .report-link{font-size:0!important;justify-content:center!important}
  .stats{grid-template-columns:1fr 1fr!important}
  table{min-width:780px!important}
}

@media(max-width:760px){
  html,body{min-width:0!important;width:auto!important;overflow-x:auto!important}
  body{display:block!important}
  aside{position:sticky!important;top:0!important;z-index:20!important;width:100%!important;height:auto!important;inset:auto!important;padding:10px 12px!important;display:block!important}
  .brand{margin:0 0 10px!important;font-size:18px!important}
  .brand img{width:36px!important;height:36px!important}
  .brand-copy{display:grid!important}
  aside nav{display:flex!important;gap:8px!important;overflow-x:auto!important;padding-bottom:4px!important}
  nav button,.report-link{width:auto!important;min-width:98px!important;min-height:42px!important;flex:0 0 auto!important;padding:9px 11px!important;font-size:12px!important;justify-content:center!important;gap:6px!important}
  nav button .nav-icon,.report-link .nav-icon{margin-right:0!important;width:22px!important;height:22px!important}
  .user{display:none!important}
  main{margin-left:0!important;width:100%!important;min-height:auto!important;padding:18px 12px 26px!important;overflow-x:auto!important}
  header{display:grid!important;gap:14px!important;align-items:start!important}
  h1{font-size:25px!important;line-height:1.1!important}
  .header-actions{display:flex!important;gap:8px!important;flex-wrap:wrap!important}
  #addDriver{width:100%!important;min-height:44px!important}
  .badge{display:none!important}
  .stats{grid-template-columns:1fr 1fr!important;gap:10px!important;margin:16px 0!important}
  .stats article{padding:14px!important;border-radius:12px!important}
  .stats strong{font-size:23px!important}
  .toolbar{display:grid!important;grid-template-columns:1fr!important;gap:10px!important;padding:12px!important}
  .panel{border-radius:12px!important;overflow:auto!important;-webkit-overflow-scrolling:touch!important}
  table{min-width:760px!important}
  th,td{padding:12px!important}
  .driver-actions{min-width:0!important;flex-wrap:wrap!important;justify-content:stretch!important}
  .driver-actions button,.driver-waybill{width:100%!important;justify-content:center!important}
  .admin-balance-widget{width:100%!important;justify-content:space-between!important;border-radius:14px!important}
  .admin-balance-widget span{max-width:none!important}
  dialog,.wide,#staffDialog{width:calc(100vw - 18px)!important;max-width:none!important;max-height:calc(100dvh - 18px)!important;padding:18px!important;border-radius:14px!important}
  dialog .close{position:sticky!important;top:0!important;float:none!important;margin-left:auto!important;display:block!important;z-index:2!important}
  .form-grid,.staff-section .form-grid,.settings-grid,.settings-grid.support-only,.schedule-driver,.details{grid-template-columns:1fr!important}
  .actions,.edit-actions{display:grid!important;grid-template-columns:1fr!important;gap:9px!important}
  .edit-actions .action-spacer{display:none!important}
  .actions button,.danger-delete{width:100%!important}
  .toolbar,.stats,.driver-summary,.details,.form-grid,.settings-grid,.schedule-driver{min-width:0!important}
  .wide-scroll,.table-wrap,.archive-list,.org-drivers-list{overflow-x:auto!important;-webkit-overflow-scrolling:touch!important}
}
