/* Mobile overrides stay after the shared desktop and theme styles. */
.mobile-home-toggle{display:none}
@media(pointer:coarse) and (max-width:900px), (pointer:coarse) and (orientation:landscape) and (max-height:600px){
 .mobile-home-ready .overview-resources{display:flex;flex-direction:column}
 .mobile-home-ready .overview-resources>.reference-library{order:0}
 .mobile-home-ready .overview-resources>.template-library{order:1}
 .mobile-home-ready .reference-library>.panel-title{border-bottom:0;padding-bottom:0}
 .mobile-home-ready .reference-intro{grid-template-columns:minmax(0,1fr);border-top:0;padding-top:0}
 .mobile-home-ready .mobile-home-toggle{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:44px;margin:10px 0;gap:8px}
 .mobile-home-toggle svg{width:18px;height:18px;flex-shrink:0}
 .mobile-home-toggle[aria-expanded=true] svg{transform:rotate(180deg)}
 .mobile-home-ready .reference-library[data-mobile-expanded=false] :is(#referenceZones,#referenceSections),
 .mobile-home-ready .template-library[data-mobile-expanded=false] :is(#insuranceTemplates,.inspection-examples){display:none}
}
@media(pointer:coarse) and (orientation:landscape) and (max-height:600px){
 .reference-atlas-viewbar{grid-template-columns:minmax(0,1fr)}
 .reference-atlas-viewbar>div{min-width:0}
 .reference-atlas-viewbar p{display:none}
 .reference-atlas-search input[type=search]{width:100%;height:100%;padding:0;margin:0;border:0!important;border-radius:0;background:transparent!important;box-shadow:none!important;outline:none!important;-webkit-appearance:none;appearance:none;color:inherit;font:inherit;font-size:16px}
}
@media(max-width:900px){
 html{scroll-padding-top:90px;scroll-padding-bottom:calc(120px + env(safe-area-inset-bottom))}
 .cabinet-content{padding-bottom:calc(124px + env(safe-area-inset-bottom))!important}
 .mobile-bottom-nav{height:calc(72px + env(safe-area-inset-bottom));padding:5px 6px calc(5px + env(safe-area-inset-bottom));grid-template-rows:61px}
 .mobile-bottom-nav button{min-width:0}
 .mobile-bottom-nav button span{font-size:11px;line-height:1.2}
 .mobile-bottom-nav .mobile-create span{font-size:11px}
 .inspection-mode-switch [data-inspection-mode=appointments]{display:none}
 [data-cabinet-view=inspections][data-active-mode=appointments] .inspection-mode-switch{display:none}
 .cabinet-view>.view-heading h2{font-size:22px}
 .cabinet-view>.view-heading{gap:12px;margin-bottom:16px}
 .calendar-grid{grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}
 .calendar-grid .calendar-day{position:relative;aspect-ratio:1;min-height:0;height:auto;min-width:0;padding:4px;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;align-items:center;gap:0;overflow:hidden}
 .calendar-day strong{grid-column:1/-1;font-size:12px;line-height:1.1}
 .calendar-grid .calendar-day>span{margin:0;font-size:11px;line-height:1.1;white-space:nowrap}
 .calendar-day .calendar-count-label{display:none}
 .calendar-day-name{min-width:0;font-size:12px}
 .account-list-row{grid-template-columns:36px minmax(0,1fr)}
 .account-list-row>#profileSupport{grid-column:1/-1;width:100%;min-height:44px;margin:4px 0 0;padding:10px 12px;white-space:normal;line-height:1.3}
 .account-list-row>div{min-width:0}
 #profileSignaturePreview{max-width:100%;height:90px}
 .profile-card{padding:16px;gap:12px}
 .profile-card>div{min-width:0;overflow-wrap:anywhere}
 .profile-detail-buttons button{padding-top:12px;padding-bottom:12px}
 .reference-atlas{height:100dvh;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}
 .reference-atlas-shell{height:100%;min-height:0}
 .reference-atlas-search{height:44px;background:var(--white);border:1px solid var(--line);box-shadow:none;padding:0 10px}
 .reference-atlas-search input[type=search]{width:100%;height:100%;padding:0;margin:0;border:0!important;border-radius:0;background:transparent!important;box-shadow:none!important;outline:none!important;-webkit-appearance:none;appearance:none;color:inherit;font:inherit;font-size:16px}
 .reference-atlas-search:focus-within{border-color:#079b85;box-shadow:0 0 0 2px rgb(7 155 133 / 12%)}
 html[data-ui-theme=dark] .reference-atlas-search{background:#20272a;color:#edf1f2;border-color:#59676d}
 html[data-ui-theme=dark] .reference-atlas-toolbar button{color:#edf1f2}
 html[data-ui-theme=dark] .reference-atlas-viewbar button{background:#293438;color:#edf1f2;border-color:#59676d}
 html[data-ui-theme=dark] .reference-atlas-viewbar button.is-active{background:#154d40;color:#a5f3d6;border-color:#27c9a0}
 html[data-ui-theme=dark] .reference-atlas-header nav,html[data-ui-theme=dark] .reference-atlas-header nav button{color:#84d8c4}
 html[data-ui-theme=dark] .reference-atlas-row small,html[data-ui-theme=dark] .reference-atlas-index-head span{color:#b3c0c3}
 html[data-ui-theme=dark] .reference-atlas-detail dd{color:#edf1f2}
 html[data-ui-theme=dark] .reference-atlas-detail dt{color:#b3c0c3}
 .reference-atlas-index{padding-bottom:max(12px,env(safe-area-inset-bottom))}
 .reference-atlas-list{overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
 .appointment-dialog footer{display:grid;grid-template-columns:1fr 1fr;gap:8px}
 #appointmentRouteLink{grid-column:1/-1;min-height:48px}
 .appointment-dialog h2{font-size:22px;line-height:1.2}
 .appointment-dialog footer a{text-decoration:none}
 #appointmentRouteMobileDisclosure,#appointmentRouteStatus{font-size:14px;line-height:1.5;overflow-wrap:anywhere}
}
@media(max-width:620px){
 .cabinet-content{padding-left:12px;padding-right:12px;padding-top:18px}
 .journal-periods{grid-template-columns:1fr 1fr;gap:10px}
 .journal-periods>div{display:grid;grid-template-columns:minmax(0,1fr);gap:5px}
 .journal-periods>div:first-child{grid-column:1/-1}
 .journal-periods select{width:100%;min-height:44px}
 .journal-heading p{font-size:13px;line-height:1.4}
 .journal-summary{grid-template-columns:1fr 1fr;gap:8px}
 .journal-summary article{min-height:0;padding:11px}
 .journal-summary article:last-child{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:8px}
 .journal-summary strong{font-size:20px;margin-top:3px}
 .journal-table{min-width:0}
 .journal-table-head{display:none}
 .journal-table-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px;gap:8px 10px;padding:14px 12px;align-items:start}
 .journal-table-row>*{padding:0;font-size:13px;overflow-wrap:anywhere}
 .journal-table-row>:nth-child(1){grid-column:1;grid-row:1;color:var(--muted)}
 .journal-table-row>:nth-child(2){grid-column:2;grid-row:1}
 .journal-table-row>:nth-child(3){grid-column:1/3;grid-row:2;font-weight:700}
 .journal-table-row>:nth-child(4){grid-column:1/3;grid-row:3}
 .journal-table-row>:nth-child(5){grid-column:1/3;grid-row:4}
 .journal-table-row>:nth-child(5)::before{content:'Убыток / заявка: ';color:var(--muted)}
 .journal-table-row>:nth-child(6){grid-column:1/3;grid-row:5;line-height:1.45}
 .journal-table-row>:nth-child(7){grid-column:1/3;grid-row:6;font-size:16px}
 .journal-table-row>:nth-child(8){grid-column:3;grid-row:1/3;width:44px;height:44px}
 .journal-services{grid-template-columns:1fr 1fr}
 .journal-form-actions{position:sticky;bottom:0;background:var(--white);padding:10px 0;margin-bottom:0}
 html[data-ui-theme=dark] .journal-form-actions{background:#242b2e}
}
/* Keep white reference artwork on one continuous surface in either theme. */
html .reference-vehicle-frame{background:#fff}
@media(max-width:900px){
  html{overflow-x:clip;-webkit-text-size-adjust:100%;text-size-adjust:100%}
  body{min-width:0;overflow-x:clip}
  .cabinet-main,.cabinet-content,.cabinet-view,.workspace-panel{min-width:0;max-width:100%}
  .cabinet-topbar{height:auto;min-height:64px;padding-top:10px;padding-bottom:10px;gap:12px}
  .cabinet-topbar .icon-button,.cabinet-top-actions{flex-shrink:0}
  .cabinet-heading{overflow-wrap:anywhere}
  .cabinet-eyebrow{line-height:1.3}
  .cabinet-content input,.cabinet-content select,.cabinet-content textarea,
  dialog input,dialog select,dialog textarea{font-size:max(16px,1em);max-width:100%;min-width:0}
  .button-primary svg,.button-secondary svg,.icon-button svg,.template-icon svg{flex-shrink:0}
  .inspection-examples{display:grid;grid-template-columns:20px minmax(0,1fr) auto;text-align:left;gap:10px}
  .inspection-examples>svg{width:20px;height:20px}
  .inspection-examples>span{min-width:0;overflow-wrap:anywhere}
  .inspection-examples>small{white-space:nowrap}
  .template-row{grid-template-columns:34px minmax(0,1fr) auto}
  .template-actions{flex-shrink:0}
  .template-actions .icon-button{width:40px;height:40px;flex:0 0 40px}
  .template-actions .icon-button svg{width:20px;height:20px}
  .appointment-dialog{width:calc(100% - 24px);max-width:700px;max-height:calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));padding:16px;overflow:auto;overscroll-behavior:contain}
  #appointmentEditor{position:fixed;top:calc(var(--editor-viewport-top,0px) + 12px + env(safe-area-inset-top));bottom:auto;margin:0 auto;max-height:calc(var(--editor-viewport-height,100dvh) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));overflow:hidden}
  #appointmentForm{max-height:calc(var(--editor-viewport-height,100dvh) - 58px - env(safe-area-inset-top) - env(safe-area-inset-bottom));min-height:0}
  #appointmentForm header{margin-bottom:16px;gap:12px}
  #appointmentForm header .icon-button{flex-shrink:0}
  #appointmentForm .appointment-fields{min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain;margin:0;padding:2px 2px 12px;gap:16px}
  #appointmentForm label{min-width:0}
  #appointmentForm input,#appointmentForm select{box-sizing:border-box;width:100%;min-width:0;max-width:100%;min-height:44px}
  #appointmentForm input[type=datetime-local]{display:block;appearance:none;-webkit-appearance:none}
  #appointmentForm input::-webkit-date-and-time-value{min-width:0;text-align:left}
  #appointmentForm input::-webkit-datetime-edit{min-width:0;padding:0}
  #appointmentForm footer{display:flex;flex-wrap:wrap;margin-top:12px;padding-top:12px;border-top:1px solid var(--line);gap:8px}
  #appointmentForm footer button{flex:1 0 auto;min-height:44px;padding:10px 12px;white-space:nowrap}
}
