.hike-inspector{display:contents}
.panel-heading-actions{display:flex;align-items:center;gap:2px}
.mobile-panel-toggle{display:none}

@media(max-width:700px),(max-width:1000px) and (max-height:500px) and (pointer:coarse){
  html{height:100%;overflow:hidden}
  body{height:var(--phone-viewport-height,100dvh);min-height:0;overflow:hidden;overscroll-behavior:none;-webkit-text-size-adjust:100%}
  main{height:100%;flex:1;min-height:0}
  .collection-heading{display:grid;grid-template-columns:minmax(0,1fr) 44px;grid-template-rows:auto auto;gap:8px;padding:10px max(12px,env(safe-area-inset-right)) 9px max(12px,env(safe-area-inset-left));padding-top:max(10px,env(safe-area-inset-top));flex:none}
  .collection-identity{grid-column:1;grid-row:1;min-width:0;max-width:100%}
  .collection-identity h1{font-size:clamp(18px,5.6vw,24px);letter-spacing:-.9px;line-height:1.2}
  #page-title .name-switch{gap:3px;min-height:44px;width:100%;white-space:nowrap}
  #page-title .heading-switch-icon{width:18px;height:18px;padding:2px;margin-left:2px}
  .heading-copy{min-width:0;white-space:nowrap}
  #person-name-wrap{vertical-align:bottom}
  .collection-heading>#import-button{grid-column:2;grid-row:1;order:initial;margin:0;padding:0;min-height:44px;width:44px;height:44px;border-radius:9px}
  #import-button .icon{width:23px;height:23px}
  .add-hike-label{display:none}
  .collection-stats{grid-column:1;grid-row:2;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;width:auto;max-width:100%;margin:0;padding:0;border:0;order:initial}
  .collection-stats>div{min-width:0;border:0;padding:0}
  .collection-stats span{font-size:18px;letter-spacing:-.5px;line-height:1.25;white-space:nowrap}
  .collection-stats em{font-size:10px;margin-left:1px}
  .collection-stats small{font-size:11px;letter-spacing:0;margin-top:2px;white-space:nowrap}
  .collection-heading>.unit-button{grid-column:2;grid-row:2;min-height:44px;width:44px;padding:0;margin:0;font-size:11px;letter-spacing:0;justify-self:end;align-self:center;border:1px solid var(--line);border-radius:8px;background:var(--white)}
  .workspace,.workspace.focused{position:relative;display:flex;flex-direction:column;flex:1;min-height:0;height:auto;grid-template-columns:none;grid-template-rows:none;width:100%;overflow:hidden}
  .map-section{order:1;flex:1;min-height:0;height:auto;max-height:none;width:100%;border:0;display:grid;grid-template-rows:minmax(0,1fr) auto;grid-template-columns:minmax(0,1fr)}
  #map{grid-column:1;grid-row:1;min-height:0;width:100%;height:100%}
  .collection-rail{order:3;flex:none;position:relative;z-index:950;min-height:62px;width:100%;border:0;border-top:1px solid var(--line);padding:3px max(8px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px,env(safe-area-inset-left));background:var(--paper)}
  .collection-rail .collection-tabs{position:static;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;align-items:stretch;border:0;margin:0}
  .collection-rail .collection-tabs button{min-height:58px;padding:7px 5px 6px;gap:4px;border:0;border-radius:9px;touch-action:manipulation}
  .collection-rail .collection-tabs button[aria-selected=true]{background:#e9eee3}
  .collection-rail .collection-tabs button[aria-selected=true]:before{display:none}
  .collection-rail .tab-icon{width:23px;height:23px}
  .collection-rail .tab-label{font-size:11px;line-height:1.2}
  .sidebar{order:2;flex:none;position:relative;width:100%;height:min(40dvh,340px);max-height:calc(100% - 180px - 62px - env(safe-area-inset-bottom));min-height:0;border:0;border-top:1px solid #d5dece;border-radius:16px 16px 0 0;box-shadow:0 -4px 18px #233c2a0a;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scroll-padding-top:12px;background:var(--paper)}
  .sidebar-tools{padding:7px max(14px,env(safe-area-inset-right)) 0 max(14px,env(safe-area-inset-left));flex:none}
  .panel-heading{min-height:44px;margin:0 0 5px;font-size:14px}
  .panel-heading .icon-button{width:44px;height:44px;min-height:44px;margin:0}
  .mobile-panel-toggle{display:grid}
  .phone-expanded .mobile-panel-toggle .icon{transform:rotate(180deg)}
  .workspace.phone-expanded .sidebar,.workspace.phone-keyboard .sidebar{position:absolute;top:0;bottom:calc(62px + env(safe-area-inset-bottom));left:0;right:0;z-index:800;height:auto;max-height:none;border-radius:14px 14px 0 0}
  .search{height:46px;padding:0 12px;gap:9px}
  .search input{font-size:16px;height:44px;min-height:44px}
  .search .icon{width:19px;height:19px}
  .search-hint{display:none}
  .filter-row{gap:9px;margin-top:9px}
  select{appearance:none;-webkit-appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%2340574b' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 16px center;background-size:16px}
  .filter-row select,#peak-list-filter{min-width:0;min-height:44px;height:44px;font-size:16px;padding:9px 44px 9px 10px;text-overflow:ellipsis}
  #peak-controls{margin-top:0}
  #peak-list-filter{font-size:16px;min-height:44px;height:44px;padding:10px 44px 10px 12px;background-position:right 16px center}
  .list-heading{padding:12px 0 8px;min-height:44px;font-size:11px;gap:8px}
  .list-heading select{font-size:16px;max-width:155px;min-height:44px;height:44px;padding:7px 44px 7px 0;background-position:right 16px center}
  .hike-list,.badge-list,.peak-list{flex:none;overflow:visible;min-height:0;max-height:none;padding:3px 12px 12px}
  .hike-card{min-height:108px;padding:16px 9px;gap:12px;margin:2px 0}
  .route-thumb{width:52px;height:55px}
  .card-title{font-size:14px;line-height:1.4;padding-right:13px}
  .card-place{font-size:12px;line-height:1.45;margin-top:5px}
  .card-metrics{font-size:12px;gap:13px;flex-wrap:wrap;margin-top:10px}
  .card-date{position:static;font-size:11px;margin-top:7px}
  .card-chevron{right:7px;top:20px}
  .card-tags>span{font-size:10px;padding:4px 6px}
  .trip-group:has(>.trip-heading){padding:0 3px 4px;margin:9px 0 18px}
  .trip-heading{min-height:44px}
  .trip-heading>span{font-size:13px}.trip-heading small{font-size:10px}
  .land-toggles{gap:8px;margin-top:12px}
  .land-toggle{flex-direction:column;gap:4px;min-width:0;min-height:72px;padding:8px 3px;font-size:12px}
  .land-toggle-symbol{width:29px;height:32px}.land-toggle-symbol .icon{width:18px;height:18px}
  .badge-summary{margin:14px 0 3px}.badge-progress-text{font-size:12px}.badge-progress-text strong{font-size:19px}
  .badge-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding-top:5px}
  .place-badge{min-height:180px;padding:17px 10px 14px}.place-badge strong{font-size:16px}.place-badge small{font-size:11px}.badge-kind{font-size:8px}
  .badge-shield{width:47px;height:54px;margin-bottom:12px}
  .peak-progress{margin-top:15px;gap:7px}.peak-progress strong{font-size:24px}.peak-progress>span{font-size:12px}
  .peak-caption{font-size:10px;gap:12px;margin-top:10px}.peak-source{min-height:32px;display:inline-flex;align-items:center;white-space:nowrap}
  .peak-card{padding:14px 9px;gap:8px;min-height:78px}
  .peak-card-body strong{font-size:14px}.peak-card-body small{font-size:12px;line-height:1.4}.peak-state{font-size:10px}
  .peak-card-symbol{width:30px;height:34px}.peak-card-symbol .icon{width:24px;height:24px}
  .map-top{top:10px;left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));justify-content:flex-end;gap:8px}
  .map-actions{gap:7px}.map-actions .map-button{min-height:44px;padding:10px 12px;font-size:12px;gap:7px;border-radius:7px}.map-actions .icon{width:16px;height:16px}
  .map-compass{display:none}
  .leaflet-control-zoom,.workspace.focused .leaflet-control-zoom,.workspace.focused:not(.has-hike) .leaflet-control-zoom{margin-right:max(10px,env(safe-area-inset-right))!important;margin-bottom:24px!important}
  .leaflet-control-zoom a{width:44px!important;height:44px!important;line-height:44px!important}
  .leaflet-control-attribution{font-size:8px!important;line-height:1.3!important}
  .leaflet-popup-content{font-size:13px;margin:18px 20px}.leaflet-popup-close-button{width:44px!important;height:44px!important;font-size:24px!important;line-height:44px!important}.area-popup strong,.peak-popup strong{padding-right:20px}
  .area-popup .text-button,.peak-popup .text-button{min-height:44px;font-size:13px}
  .hike-inspector{display:block;grid-column:1;grid-row:2;position:relative;height:min(43dvh,340px);max-height:calc(var(--phone-viewport-height,100dvh) - var(--phone-header-height,115px) - 62px - env(safe-area-inset-bottom) - 160px);min-height:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;background:var(--white);border-top:1px solid #d6dfcf;border-radius:15px 15px 0 0;box-shadow:0 -4px 16px #244b3a0c;scroll-padding:12px}
  .detail-panel,.workspace.focused .detail-panel{position:relative;left:auto;right:auto;top:auto;bottom:auto;width:100%;max-width:none;min-height:0;max-height:none;overflow:visible;padding:16px 16px 9px;border:0;border-radius:0;box-shadow:none}
  .detail-panel h2,.workspace.focused .detail-panel h2{font-size:23px;line-height:1.2;padding-right:36px}
  .detail-panel .icon-button{top:8px;right:8px;width:44px;height:44px;min-height:44px}
  .detail-meta{font-size:12px;margin:7px 0 10px}
  .detail-stats,.workspace.focused .detail-stats{margin:10px 0;padding:12px 0;gap:9px}
  .detail-stats strong,.workspace.focused .detail-stats strong{font-size:18px;white-space:nowrap}
  .detail-stats span,.workspace.focused .detail-stats span{font-size:8px;letter-spacing:.6px}
  .detail-trip{font-size:12px;margin:9px 0}.detail-tags{margin-top:8px}.detail-tags>span{font-size:11px}
  .detail-places{margin:10px 0;gap:6px}.place-chip{font-size:10px;padding:5px 7px;min-height:27px}
  .detail-actions{margin-top:12px;gap:8px}.detail-actions .button{min-height:44px;font-size:12px;padding:9px 12px}.detail-actions .delete-button{width:44px;height:44px;min-height:44px;padding:12px}
  .detail-actions .icon{width:17px;height:17px}.detail-notes{max-height:none;font-size:13px;line-height:1.65}
  .profile-panel,.workspace.focused .profile-panel{position:relative;left:auto;right:auto;top:auto;bottom:auto;width:100%;max-width:none;margin:0;min-height:0;padding:12px 12px 14px;border:0;border-top:1px solid var(--line);border-radius:0;box-shadow:none}
  .profile-heading{flex-wrap:wrap;gap:5px;margin-bottom:7px;min-height:20px}.profile-heading h2{font-size:13px}.profile-heading output{font-size:11px}
  .profile-chart-wrap{height:150px}.profile-status{font-size:13px;line-height:1.5}
  .map-error{padding:20px;width:min(320px,90%)}.map-error strong{font-size:21px}.map-error span{font-size:13px}.map-error .text-button{min-height:44px}
  dialog{position:fixed;padding:20px 16px;width:calc(100% - 20px);max-width:560px;max-height:calc(var(--phone-viewport-height,100dvh) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));margin:auto;border-radius:14px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scroll-padding:16px}
  .dialog-heading{gap:12px;margin-bottom:18px}.dialog-heading h2{font-size:28px;line-height:1.15}.dialog-heading .icon-button{width:44px;height:44px;min-height:44px;flex-shrink:0;margin:-6px -6px 0 0}
  .dialog-heading .eyebrow{font-size:9px}.field{font-size:13px;margin-top:16px}.optional{font-size:11px}
  .field input,.field select,.field textarea{min-width:0;width:100%;max-width:100%;font-size:16px;min-height:46px;padding:11px 10px;line-height:1.4}
  .field select{height:46px;padding-right:44px}
  .field input[type=date]{appearance:none;-webkit-appearance:none;min-height:46px}.field input::-webkit-date-and-time-value{text-align:left}
  .field textarea{min-height:100px}.form-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .dropzone{padding:22px 14px;min-height:132px}.dropzone strong{font-size:15px}.dropzone>span:last-child{font-size:12px}
  .auto-trip-choice{font-size:12px;gap:9px;min-height:44px;margin-top:8px}.auto-trip-choice input,.tag-choices input{width:19px;height:19px;flex-shrink:0}
  .tag-field,.color-field{font-size:13px}.tag-choices{gap:8px}.tag-choices label{font-size:13px;min-height:46px;padding:10px;gap:8px}
  .color-options{gap:10px;flex-wrap:wrap}.color-swatch{width:44px;height:44px}
  .dialog-footer{position:sticky;bottom:-20px;z-index:2;padding:14px 0 4px;margin-top:20px;background:var(--white);gap:9px}.dialog-footer .button{min-height:46px;font-size:14px;flex:1}
  .form-error,.form-hint{font-size:12px;line-height:1.6}
  .basemap-dialog{padding:20px 16px;max-width:560px;width:calc(100% - 20px)}.basemap-dialog .dialog-heading h2{font-size:27px}.basemap-options{grid-template-columns:1fr;gap:12px}
  .basemap-card{display:grid;grid-template-columns:100px minmax(0,1fr);column-gap:12px;padding-bottom:12px;min-height:150px}.basemap-card img{grid-column:1;grid-row:1/5;height:100%;min-height:150px;border-right:1px solid var(--line);border-bottom:0;margin-bottom:-12px}.basemap-card small{grid-column:2;font-size:8px;margin:14px 12px 0 0}.basemap-card strong{grid-column:2;font-size:24px;margin:5px 12px 7px 0}.basemap-description{grid-column:2;font-size:12px;line-height:1.5;margin:0 12px 12px 0}.basemap-selected{grid-column:2;font-size:11px;margin:0 12px 0 0;padding-top:9px}
  .toast{bottom:calc(76px + env(safe-area-inset-bottom));font-size:13px;padding:12px 16px;width:max-content;max-width:calc(100% - 28px)}
}

@media(max-width:360px){
  .collection-heading{padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right));column-gap:6px}
  #page-title .heading-switch-icon{display:none}.collection-stats span{font-size:16px}.collection-stats small{font-size:11px;letter-spacing:0}
  .peak-state{display:none}.detail-stats strong,.workspace.focused .detail-stats strong{font-size:16px}.form-grid{grid-template-columns:minmax(0,1fr)}
}

@media(max-width:1000px) and (max-height:500px) and (orientation:landscape) and (pointer:coarse){
  .collection-heading{grid-template-columns:minmax(0,1fr) minmax(220px,1fr) 44px 44px;grid-template-rows:auto;padding-top:max(6px,env(safe-area-inset-top));padding-bottom:6px;column-gap:12px}
  .collection-identity{grid-column:1;grid-row:1}.collection-identity h1{font-size:22px}
  .collection-stats{grid-column:2;grid-row:1}.collection-heading>.unit-button{grid-column:3;grid-row:1}.collection-heading>#import-button{grid-column:4;grid-row:1}
  .workspace{display:grid;grid-template-columns:minmax(0,1fr) min(42vw,350px);grid-template-rows:minmax(0,1fr) auto}
  .workspace.focused{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto}
  .map-section{grid-column:1;grid-row:1;height:100%;min-height:0}.sidebar{grid-column:2;grid-row:1;width:100%;height:100%;max-height:none;border:0;border-left:1px solid var(--line);border-radius:0}
  .collection-rail{grid-column:1/-1;grid-row:2;min-height:54px;padding-top:0}.collection-rail .collection-tabs button{min-height:52px;flex-direction:row;gap:9px}.collection-rail .tab-icon{width:21px;height:21px}
  .workspace.phone-expanded .sidebar,.workspace.phone-keyboard .sidebar{grid-column:1/-1;bottom:calc(54px + env(safe-area-inset-bottom))}
  .workspace.has-hike .map-section{grid-template-columns:minmax(0,1fr) min(42vw,350px);grid-template-rows:minmax(0,1fr)}
  .hike-inspector{grid-column:2;grid-row:1;height:100%;max-height:none;border-top:0;border-left:1px solid var(--line);border-radius:0;box-shadow:none}
  .workspace.has-hike .map-top{right:calc(min(42vw,350px) + max(10px,env(safe-area-inset-right)))}
  .detail-panel,.workspace.focused .detail-panel{padding:12px 14px 8px}.detail-panel h2,.workspace.focused .detail-panel h2{font-size:21px}
  .profile-chart-wrap{height:140px}
}

@media(max-width:700px) and (max-height:500px) and (orientation:landscape) and (pointer:coarse){
  .collection-heading{grid-template-columns:minmax(0,1fr) 44px 44px;column-gap:10px}
  .collection-stats{display:none}
  .collection-heading>.unit-button{grid-column:2}.collection-heading>#import-button{grid-column:3}
}

/* Dashboard navigation shares the existing rail and phone safe areas. */
.collection-stat-link:hover small{text-decoration:underline;text-underline-offset:3px;color:var(--green)}
.locate-button{display:inline-flex;align-items:center;justify-content:center;width:44px;min-height:44px;padding:10px!important}
.locate-button[aria-busy=true]{opacity:.55;cursor:progress}
.workspace.showing-stats{grid-template-columns:80px minmax(0,1fr)}
.workspace.showing-stats .sidebar,.workspace.showing-stats .map-section{display:none}
#stats-panel{grid-column:2;grid-row:1;min-height:0;min-width:0}
@media(max-width:1150px){.workspace.showing-stats{grid-template-columns:76px minmax(0,1fr)}}
@media(max-width:900px){.workspace.showing-stats{grid-template-columns:72px minmax(0,1fr)}}
@media(max-width:700px),(max-width:1000px) and (max-height:500px) and (pointer:coarse){
 .workspace.showing-stats{display:flex;flex-direction:column;min-height:0}
 .workspace.showing-stats #stats-panel{order:1;flex:1;width:100%;min-height:0}
 .workspace.showing-stats .collection-rail{order:3;flex:none}
}

@media(max-width:700px),(max-width:1000px) and (max-height:500px) and (pointer:coarse){.leaflet-control-zoom{display:none!important}}

@media(max-width:700px) and (orientation:portrait){
 .collection-heading{grid-template-columns:minmax(0,1fr) 44px 44px;grid-template-rows:auto auto;gap:3px 8px;padding-top:max(6px,env(safe-area-inset-top));padding-bottom:6px}
 .collection-identity h1{font-size:clamp(17px,5.2vw,22px)}
 .collection-heading>#import-button{grid-column:3;grid-row:1}
 .collection-heading>.unit-button{grid-column:2;grid-row:1}
 .collection-stats{grid-column:1/-1;grid-row:2}
 .collection-stats span{font-size:16px;line-height:1.2}
 .collection-stats em{font-size:11px}
 .collection-stats small{font-size:11px;line-height:1.2;letter-spacing:0;margin-top:2px}
 .collection-heading .collection-stat-link{min-height:44px}
}
