/* Client UI only. Desktop rules remain in the original stylesheets. */
.history-filter-toggle,.mobile-sidebar-shade{display:none}
@media(max-width:900px){
 .topbar{grid-template-columns:minmax(0,1fr) auto auto;grid-template-rows:auto;gap:8px;padding:6px 10px;min-height:58px}
 .brand{grid-column:1;font-size:17px}.nav-toggle{grid-column:2;width:44px;height:44px}
 .user-menu{grid-column:3;grid-row:1;max-width:none;overflow:visible;white-space:normal;gap:4px}
 .user-menu .link-btn{min-height:44px}.main-nav{margin:0;max-height:55vh;overflow:auto}
 .nav-link{min-height:44px;display:flex;align-items:center;justify-content:center}
 .user-menu:has(.return-admin-btn){grid-column:1/-1;grid-row:3;justify-self:stretch;flex-wrap:wrap}
 .history-controls{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
}
@media(max-width:760px){
 body{font-size:15px} input:not([type=checkbox]):not([type=radio]):not([type=file]),select,textarea{font-size:16px;min-height:44px;max-width:100%;min-width:0}
 .primary,.secondary,.danger,.danger-button,.icon-btn,.modal-close{min-height:44px}
 .login-page{min-height:100vh;min-height:100dvh;padding:16px}.login-card{padding:24px 18px}.login-card .primary{min-height:50px}
 .monitoring-page,.history-page{height:100vh;height:100dvh;display:flex;flex-direction:column;overflow:hidden}
 .monitoring-page>.topbar,.history-page>.topbar{flex:none}
 .monitor-layout,.history-layout{flex:1 1 0;height:auto;min-height:0;min-width:0}
 .monitor-layout{overflow:hidden}.device-sidebar{width:min(390px,94vw);height:auto;overflow:auto;visibility:hidden;box-shadow:none}
 body.device-sidebar-open .device-sidebar{visibility:visible;box-shadow:6px 0 22px #0003}
 .mobile-sidebar-shade{position:absolute;inset:0;z-index:1040;background:#0005;border:0;width:100%;height:100%}
 body.device-sidebar-open .mobile-sidebar-shade{display:block}
 .mobile-sidebar-close{width:44px;height:44px}.mobile-sidebar-open{min-height:44px}
 .sidebar-head,.sidebar-search{flex:none}.monitor-device-list{flex:1 0 100px;overscroll-behavior:contain}
 .monitor-device{min-height:62px}.monitor-device-title{white-space:normal;overflow-wrap:anywhere}
 .monitor-display-settings-toggle{min-height:44px}.map-message{top:65px;width:max-content;max-width:calc(100% - 24px)}
 .history-layout{display:flex;flex-direction:column;overflow:auto}
 .history-filter-toggle{display:block;flex:none;margin:8px 10px 0;text-align:left}
 .history-controls{flex:none;grid-template-columns:minmax(0,1fr);gap:8px;padding:10px;max-height:50vh;overflow:auto}
 .history-device-field{grid-column:auto}.history-presets{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}.history-presets button{padding:6px 2px;font-size:13px}
 .history-layout.filters-collapsed .history-controls{display:none}
 .history-summary{flex:none;display:block;padding:8px 10px;max-height:22vh;overflow:auto}
 #historyStats{display:block;white-space:normal;overflow-wrap:anywhere;text-align:left}
 .history-map-shell{flex:1 0 180px;min-height:180px}.history-message,.history-loading{width:max-content;max-width:calc(100% - 80px)}
 .map-popup,.history-popup{min-width:0;overflow-wrap:anywhere}.leaflet-popup-content{max-width:calc(100vw - 85px);overflow-wrap:anywhere}
 .page-container{width:100%;min-width:0;padding:12px 10px 24px}
 .responsive-card-table td{display:block;overflow-wrap:anywhere;padding:8px 12px}
 .responsive-card-table td::before{display:block;margin-bottom:3px}
 .responsive-card-table td[data-label="Статус"] .device-status-dot{vertical-align:middle}
 .responsive-card-table td.loading,.responsive-card-table td.empty{display:block}
 .device-name-text{min-width:0;overflow-wrap:anywhere}.row-actions button{flex:1 1 auto}
 .modal-panel,.device-modal-panel,.stop-modal-panel,.import-stops-panel{width:100%;height:100%;max-height:100vh;max-height:100dvh;overflow:auto}
 .form-actions{flex-wrap:wrap}.form-actions-spacer{display:none}.pager{position:static;flex-wrap:wrap}
 .stops-workspace{min-height:0;grid-template-columns:minmax(0,1fr)}
 .stops-map-card{height:52vh;min-height:260px}.stops-list{height:35vh;min-height:180px}
 .stop-name{white-space:normal;overflow-wrap:anywhere}.stop-list-row{min-height:54px;grid-template-columns:42px minmax(0,1fr) auto;padding:8px}
 .stops-tabs button{flex:1;min-height:44px}.stops-map-hint{width:max-content;max-width:calc(100% - 80px)}
 .voice-table{min-width:0;white-space:normal}.voice-table thead{display:none}
 .voice-table,.voice-table tbody,.voice-table tr,.voice-table td{display:block;width:100%}
 .voice-table tr{border-bottom:8px solid var(--bg);padding:8px}.voice-table td{padding:6px 8px;overflow-wrap:anywhere}
 .voice-table td[data-label]::before{content:attr(data-label);display:block;font-size:12px;color:var(--muted);font-weight:700;margin-bottom:3px}
 .voice-table input{width:100%;min-width:0}.voice-save{width:100%}
}
@media(max-width:760px) and (orientation:landscape){.history-controls{max-height:45vh}.history-map-shell{flex-basis:150px;min-height:150px}}
