/* MMRENTAL office: mobile navigation and compact phone layout. */
.mobile-office-menu,
.mobile-office-backdrop{display:none}

@media (max-width: 820px){
  html,body{width:100%;max-width:100%;overflow-x:hidden}
  body.mobile-office-menu-open{overflow:hidden;touch-action:none}
  .shell{min-height:100dvh}.shell:not(.hidden){display:block!important}
  .main{width:100%;min-width:0;min-height:100dvh;margin:0}

  .mobile-office-menu{
    display:grid;place-items:center;position:fixed;z-index:1003;
    top:max(10px,env(safe-area-inset-top));right:12px;width:46px;height:46px;
    padding:0;border:1px solid rgba(255,255,255,.13);border-radius:14px;
    background:rgba(19,19,19,.88);box-shadow:0 12px 34px rgba(0,0,0,.32);
    -webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px)
  }
  .mobile-office-menu span,.mobile-office-menu:before,.mobile-office-menu:after{
    content:"";position:absolute;width:20px;height:2px;border-radius:9px;
    background:#fff;transition:transform .28s ease,opacity .2s ease,top .28s ease
  }
  .mobile-office-menu span{top:22px}
  .mobile-office-menu:before{top:16px}
  .mobile-office-menu:after{top:28px}
  .mobile-office-menu[aria-expanded="true"] span{opacity:0}
  .mobile-office-menu[aria-expanded="true"]:before{top:22px;transform:rotate(45deg)}
  .mobile-office-menu[aria-expanded="true"]:after{top:22px;transform:rotate(-45deg)}

  .mobile-office-backdrop{
    display:block;position:fixed;z-index:1000;inset:0;
    background:rgba(0,0,0,.62);opacity:0;visibility:hidden;
    -webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);
    transition:opacity .28s ease,visibility .28s ease
  }
  body.mobile-office-menu-open .mobile-office-backdrop{opacity:1;visibility:visible}

  .sidebar{
    display:flex!important;position:fixed!important;z-index:1002!important;
    top:0!important;right:0!important;bottom:0!important;left:auto!important;
    width:min(88vw,360px)!important;height:100dvh!important;
    padding:max(18px,env(safe-area-inset-top)) 16px max(18px,env(safe-area-inset-bottom))!important;
    transform:translate3d(105%,0,0);opacity:0;visibility:hidden;
    overflow-y:auto;overscroll-behavior:contain;
    border-left:1px solid rgba(255,255,255,.1)!important;border-right:0!important;
    box-shadow:-24px 0 60px rgba(0,0,0,.45);
    transition:transform .32s cubic-bezier(.22,.8,.24,1),opacity .22s ease,visibility .32s ease
  }
  body.mobile-office-menu-open .sidebar{transform:translate3d(0,0,0);opacity:1;visibility:visible}
  .sidebar-brand{padding-right:58px;margin-bottom:18px}
  .sidebar nav{display:flex;flex-direction:column;gap:6px}
  .sidebar nav button{min-height:48px;width:100%;padding:12px 14px;border-radius:13px;text-align:left}
  .sidebar .nav-sep{margin:8px 0}
  .sidebar-bottom{position:static!important;margin-top:auto;padding-top:18px}
  .sidebar-bottom .user-card{min-height:52px;min-width:0;flex:1}

  .topbar{
    position:sticky;z-index:900;top:0;display:grid!important;
    grid-template-columns:minmax(0,1fr) 52px;gap:10px;align-items:center;
    min-height:68px;padding:max(10px,env(safe-area-inset-top)) 12px 10px!important;
    background:rgba(10,10,10,.9)!important;border-bottom:1px solid rgba(255,255,255,.08);
    -webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px)
  }
  .topbar>div:first-child{min-width:0;padding-right:2px}
  .topbar .eyebrow{font-size:9px;letter-spacing:.14em;margin-bottom:3px}
  .topbar h2{font-size:19px;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .topbar #pageSubtitle{display:none}
  .top-actions{grid-column:1/-1;display:grid!important;grid-template-columns:minmax(0,1fr) auto;gap:8px;width:100%}
  .top-actions .search{width:100%;min-width:0}
  .top-actions .search input{width:100%;font-size:16px}
  #refreshBtn{min-height:42px;padding:9px 13px}

  .content{width:100%;min-width:0;padding:12px!important}
  .content>*{max-width:100%}
  .content-head,.section-head,.toolbar,.filters,.filterbar,.equipment-top,.rentals-top{
    align-items:stretch!important;flex-wrap:wrap!important;gap:8px!important
  }
  .content-head>*,.section-head>*,.toolbar>*,.filters>*{min-width:0}
  .stats-grid,.dashboard-grid,.cards,.finance-kpis,.rental-summary-strip,
  .rental-equipment-top,.form-grid,.details-grid,.equipment-card-grid{
    grid-template-columns:1fr!important
  }
  .card,.panel,.stat-card{border-radius:15px!important}

  .table-wrap,.table-scroll,.equipment-table-wrap{
    width:100%;max-width:100%;overflow-x:auto!important;overflow-y:visible;
    -webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;border-radius:14px
  }
  table{min-width:720px}
  th,td{padding:11px 10px!important}
  .table-wrap:after,.table-scroll:after{
    content:"Листайте таблицу влево и вправо";display:block;position:sticky;left:0;
    padding:8px 10px;color:#777;font-size:11px;text-align:center
  }

  input,select,textarea,button{font-size:16px}
  input,select,textarea{max-width:100%}
  .form-actions,.modal-actions{display:flex!important;flex-wrap:wrap!important;gap:8px!important}
  .form-actions>button,.modal-actions>button{flex:1 1 150px;min-height:44px}

  .modal{align-items:flex-end!important;padding:8px 8px 0!important}
  .modal-card{
    width:100%!important;max-width:none!important;max-height:calc(100dvh - 8px)!important;
    margin:0!important;border-radius:20px 20px 0 0!important;overflow:hidden
  }
  .modal-head{position:sticky;z-index:6;top:0;padding:14px!important;background:rgba(18,18,18,.96)}
  .modal-head h3{font-size:18px!important}
  .modal-body{max-height:calc(100dvh - 76px)!important;padding:12px!important;overflow:auto!important}
  .modal-body .form-grid{gap:12px!important}
  .modal-body .full,.modal-body [style*="grid-column"]{grid-column:1!important}

  #equipmentImportActions{width:100%;margin-left:0!important;display:grid!important;grid-template-columns:1fr!important}
  #equipmentImportActions button{width:100%;min-height:44px}
  .equipment-design-open-v13{width:44px!important;min-width:44px!important;flex:0 0 44px!important}
}

@media (max-width: 420px){
  .content{padding:10px!important}
  .top-actions{grid-template-columns:1fr}
  #refreshBtn{width:100%}
  .modal{padding:0!important}
  .modal-card{max-height:100dvh!important;border-radius:0!important}
  .modal-body{max-height:calc(100dvh - 68px)!important}
}

@media (prefers-reduced-motion:reduce){
  .mobile-office-menu,.mobile-office-menu:before,.mobile-office-menu:after,
  .mobile-office-backdrop,.sidebar{transition:none!important}
}

/* Phone workspace 20261122: no desktop overrides. */
@media(max-width:600px){
html,body{height:100%;overflow:hidden}
#shell.shell:not(.hidden){height:100dvh;min-height:0;overflow:hidden}
#shell>.main{height:100dvh;min-height:0;display:flex;flex-direction:column;overflow:hidden}
#shell .topbar{position:relative;flex:0 0 auto;min-height:0;grid-template-columns:minmax(0,1fr) 48px;gap:10px;padding:12px!important;padding-top:max(12px,env(safe-area-inset-top))!important}
#shell .topbar h2{font-size:21px;line-height:1.2}
#shell .top-actions{grid-template-columns:minmax(0,1fr) 44px!important;gap:8px}
#shell .search{height:44px;border-radius:12px}
#shell #refreshBtn{width:44px;height:44px;min-height:44px;padding:0;font-size:0}
#shell #refreshBtn:before{content:'↻';font-size:25px}
#shell #view.content{flex:1 1 0;min-height:0;overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior-y:contain;padding:14px 12px max(24px,env(safe-area-inset-bottom))!important;scrollbar-gutter:auto}
#shell #view :is(.stats,.analytics-stats){grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px;margin-bottom:16px}
#shell #view .stats>.stat{min-width:0;min-height:124px;display:flex;flex-direction:column;gap:6px;padding:13px;border-radius:15px}
#shell #view .stats .stat-top{min-height:30px;font-size:11px;line-height:15px;gap:6px}
#shell #view .stats .dot{flex:0 0 7px;margin-top:4px}
#shell #view .stats .stat-value{font-size:clamp(20px,6vw,28px);line-height:1.15;height:auto;min-height:32px;margin:0;white-space:normal;overflow-wrap:anywhere;overflow:visible}
#shell #view .stats .stat-foot{height:auto;min-height:48px;line-height:16px;font-size:10px;white-space:normal;overflow-wrap:anywhere;overflow:visible}
#shell #view :is(.grid-2,.grid-3,.form-grid,.form-grid-3,.form-grid-4,.details-grid,.equipment-card-grid,.finance-kpis,.rental-summary-strip,.owner-value-grid,.quick){grid-template-columns:minmax(0,1fr)!important;gap:10px}
#shell #view :is(.toolbar,.panel-head,.wallet-toolbar,.payroll-panel-head){display:flex;flex-direction:column;align-items:stretch!important;gap:12px;padding:14px;min-width:0}
#shell #view .toolbar{padding:0;margin-bottom:14px}
#shell #view :is(.toolbar,.panel-head) h3{font-size:18px;line-height:1.3;white-space:normal;overflow-wrap:anywhere}
#shell #view :is(.panel-head,.toolbar) p{line-height:1.5;margin:4px 0 0}
#shell #view :is(.toolbar-actions,.wallet-actions,.payroll-tools,.filters,.rental-filterbar,.availability-range,.analytics-range-controls){display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:12px!important;width:100%;max-width:100%;min-width:0;flex:none;margin:0}
#shell #view :is(.toolbar-actions,.wallet-actions,.payroll-tools,.filters,.rental-filterbar,.availability-range)>*{min-width:0;width:100%;max-width:100%;margin:0;grid-column:auto}
#shell #view :is(.payroll-tools,.filters,.rental-filterbar,.availability-range) label{min-width:0;display:flex;flex-direction:column;gap:6px}
#shell #view :is(#walletUserSelect,select,input:not([type=checkbox]):not([type=radio]),textarea,.ru-date-input){min-width:0!important;max-width:100%!important;width:100%;font-size:16px}
#shell #view :is(select,input:not([type=checkbox]):not([type=radio]),.ru-date-input){min-height:44px}
#shell #view :is(button.primary,button.ghost,button.danger,button.soft){min-height:44px;white-space:normal;line-height:1.3}
#shell #view .wallet-balance-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:12px}
#shell #view .wallet-balance-card{min-width:0;padding:12px;text-align:left;white-space:normal;overflow-wrap:anywhere}
#shell #view .wallet-balance-card b{font-size:20px;overflow-wrap:anywhere}
#shell #view .wallet-balance-card span{font-size:12px;line-height:1.4}
#shell #view .analytics-range-controls>.analytics-period{width:100%;flex:none}
#shell #view #analyticsDateRange{width:100%;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
#shell #view .analytics-chart-summary{justify-content:stretch;padding:0 14px 12px}
#shell #view .analytics-chart-summary>div{white-space:normal;line-height:1.5}
#shell #view :is(.panel-body,.scan-box){padding:14px}
#shell #view .empty{padding:32px 16px;line-height:1.5}
#shell #view .table-wrap:has(>table[data-phone-cards]){overflow:visible!important;border-radius:0}
#shell #view .table-wrap:has(>table[data-phone-cards]):after{display:none}
#shell #view table.table[data-phone-cards]{display:block!important;width:100%!important;min-width:0!important;table-layout:auto!important;border-collapse:separate}
#shell #view table[data-phone-cards]>thead{display:none}
#shell #view table[data-phone-cards]>tbody{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;padding:12px}
#shell #view table[data-phone-cards]>tbody>tr{display:block;min-width:0;margin:0;border:1px solid #303035;border-radius:14px;background:#151517;padding:4px 12px;overflow:hidden}
#shell #view table[data-phone-cards]>tbody>tr>td{display:block;position:relative;width:100%!important;min-width:0;max-width:none;padding:11px 0 11px 115px!important;min-height:42px;white-space:normal!important;text-align:left!important;border-bottom:1px solid #28282d;font-size:13px;line-height:1.45;overflow-wrap:anywhere}
#shell #view table[data-phone-cards]>tbody>tr>td:before{content:attr(data-phone-label);position:absolute;left:0;top:12px;width:105px;color:#8f9097;font-size:11px;font-weight:600;line-height:1.4;letter-spacing:0;text-transform:none}
#shell #view table[data-phone-cards]>tbody>tr>td:last-child{border-bottom:0}
#shell #view table[data-phone-cards] td>*{min-width:0;max-width:100%}
#shell #view table[data-phone-cards] td :is(.badge,button){white-space:normal;max-width:100%}
#modal.modal{z-index:1200;padding:0!important;align-items:stretch!important}
#modal .modal-card{height:100dvh;max-height:100dvh!important;width:100vw!important;border-radius:0!important;border:0;min-width:0}
#modal .modal-head{flex:0 0 auto;padding:14px!important;padding-top:max(14px,env(safe-area-inset-top))!important;gap:12px;align-items:center}
#modal .modal-head>div{min-width:0}
#modal .modal-head h3{font-size:18px;line-height:1.35;overflow-wrap:anywhere}
#modal .modal-head>.icon-btn{width:44px;height:44px;flex:0 0 44px;font-size:24px}
#modal #modalBody{flex:1 1 0;min-height:0;max-height:none!important;overflow:auto!important;padding:14px 12px max(24px,env(safe-area-inset-bottom))!important;overscroll-behavior:contain}
#modal :is(.form-grid,.form-grid-3,.form-grid-4,.finance-kpis,.equipment-card-grid,.rental-summary-strip,.rental-main-cards,.org-tables-grid,.details-grid){display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:12px!important;min-width:0}
#modal :is(.form-grid,.rental-main-cards)>*{grid-column:auto!important;min-width:0}
#modal :is(.rental-head,.rental-equipment-top,.rental-equipment-toolbar,.rental-equipment-topline,.panel-head){display:flex;flex-direction:column;align-items:stretch;gap:12px;min-width:0}
#modal :is(.rental-head-badges,.rental-equipment-document-actions,.equipment-request-actions-header){display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-start}
#modal .rental-tabs{display:flex;flex-wrap:nowrap;overflow-x:auto;gap:4px;flex-shrink:0;padding-bottom:4px}
#modal .rental-tabs button{min-height:44px;flex:0 0 auto;padding:10px 12px}
#modal :is(input:not([type=checkbox]):not([type=radio]),select,textarea,.ru-date-input){font-size:16px!important;max-width:100%!important;min-width:0!important}
#modal :is(input:not([type=checkbox]):not([type=radio]),select,.ru-date-input){min-height:44px}
#modal textarea{min-height:96px;height:auto;line-height:1.5}
#modal .form-actions{position:static;display:grid!important;grid-template-columns:minmax(0,1fr);padding:14px 0 0;margin-top:16px;background:none}
#modal :is(.form-actions,.modal-actions)>button{width:100%;min-height:46px;line-height:1.3;white-space:normal}
#modal .table-wrap{overflow-x:auto!important;max-width:100%}
#modal #rentalTabBody .rental-main-inline .rental-main-cards{grid-template-columns:minmax(0,1fr)!important}
#modal #rentalTabBody .rental-main-inline .rental-main-native-field{height:auto!important;min-height:44px!important;max-height:none!important;min-width:0!important}
#modal #rentalTabBody .rental-main-inline .rental-main-native-field :is(input,select){height:44px!important;max-width:100%!important;padding:10px!important}
#modal #rentalTabBody :is(.rental-main-card,.org-inline-editor) table{min-width:0!important;width:100%!important}
#modal #rentalTabBody :is(.rental-main-card,.org-inline-editor) tr{height:auto!important;min-height:0!important}
#modal #rentalTabBody :is(.rental-main-card,.org-inline-editor) :is(th,td){height:auto!important;min-height:0!important;padding:10px 8px!important;white-space:normal!important;overflow-wrap:anywhere}
#modal #rentalTabBody .rental-main-card :is(table,tbody,tr,th,td){display:block!important;width:100%!important}
#modal #rentalTabBody .rental-main-inline #rComment{min-height:110px!important;height:auto!important;resize:vertical}
#modal .document-actions{display:grid;grid-template-columns:1fr;gap:10px}
.toast{z-index:2000;left:12px;right:12px;bottom:max(12px,env(safe-area-inset-bottom));max-width:none;line-height:1.5}
#auth .auth-panel{padding:20px 12px}
#auth .auth-card{padding:24px 18px;max-width:100%}
#auth .auth-card :is(input,button){min-height:46px;font-size:16px}
#auth .auth-card .check input{min-height:0}
}
@media(max-width:360px){#shell #view :is(.stats,.analytics-stats,.wallet-balance-grid){grid-template-columns:minmax(0,1fr)!important}}

/* Compact phone rental summary; leave space for the active tab. */
@media(max-width:600px){
#modal .modal-card.rental-equipment-modal:has(.rental-summary-strip){height:100dvh!important;max-height:100dvh!important}
#modal .modal-card.rental-equipment-modal>.modal-body:has(>.rental-summary-strip){display:flex!important;flex-direction:column;flex:1 1 0!important;min-height:0!important;overflow:hidden!important;padding:10px 12px max(12px,env(safe-area-inset-bottom))!important}
#modal .modal-body:has(>.rental-summary-strip)>.rental-head{flex:0 0 auto;gap:6px!important;margin:0 0 8px!important}
#modal .modal-body:has(>.rental-summary-strip) .rental-head h3{font-size:20px!important;line-height:1.2;margin:2px 0 4px}
#modal .modal-body:has(>.rental-summary-strip) .rental-head p{font-size:10px;line-height:1.35;margin:0}
#modal .modal-body:has(>.rental-summary-strip) .rental-head .eyebrow{font-size:9px;line-height:1.2}
#modal .modal-body:has(>.rental-summary-strip) .rental-head-badges{gap:5px!important}
#modal .modal-body:has(>.rental-summary-strip) .rental-head-badges .badge{font-size:9px;line-height:1.3;padding:4px 7px;white-space:normal}
#modal .modal-body>.rental-summary-strip{display:grid!important;grid-template-columns:repeat(6,minmax(0,1fr))!important;grid-template-rows:auto auto auto;grid-auto-flow:row;gap:1px!important;margin:0 0 8px!important;border-radius:10px;flex:0 0 auto;min-height:0}
#modal .modal-body>.rental-summary-strip>div{min-width:0;min-height:0;padding:6px 8px!important;text-align:left!important;grid-row:auto!important;grid-column:auto!important}
#modal .modal-body>.rental-summary-strip>div:nth-child(1){grid-column:1/5!important;grid-row:1!important}
#modal .modal-body>.rental-summary-strip>div:nth-child(2){grid-column:1/-1!important;grid-row:2!important}
#modal .modal-body>.rental-summary-strip>div:nth-child(3){grid-column:5/7!important;grid-row:1!important}
#modal .modal-body>.rental-summary-strip>div:nth-child(4){grid-column:1/3!important;grid-row:3!important}
#modal .modal-body>.rental-summary-strip>div:nth-child(5){grid-column:3/5!important;grid-row:3!important}
#modal .modal-body>.rental-summary-strip>div:nth-child(6){grid-column:5/7!important;grid-row:3!important}
#modal .modal-body>.rental-summary-strip span{font-size:9px!important;line-height:1.2;letter-spacing:.025em;margin:0 0 3px!important;white-space:normal}
#modal .modal-body>.rental-summary-strip b{display:block;font-size:11px!important;line-height:1.3;font-weight:700;white-space:normal;overflow-wrap:anywhere}
#modal .modal-body>.rental-summary-strip .rental-summary-period b{font-size:10px!important}
#modal .modal-body:has(>.rental-summary-strip)>.rental-tabs{flex:0 0 auto;margin:0 0 8px!important;padding-bottom:0;min-height:40px}
#modal .modal-body:has(>.rental-summary-strip)>.rental-tabs button{font-size:12px;min-height:40px;padding:8px 10px}
#modal .modal-card.rental-equipment-modal>.modal-body>#rentalTabBody{display:block!important;flex:1 1 0!important;min-height:0!important;height:auto!important;max-height:none!important;overflow:auto!important;overscroll-behavior:contain;padding-top:0!important}
}
