/* Phone layout (≤900px): bottom tab bar, Search / Filters sheets, full-width panels, 16px inputs (no iOS zoom), safe-area padding.
   Loaded after the main styles so these rules win. Nothing here applies on desktop. */
.mtabs,.mact,#mFilters{display:none}
@media(max-width:900px){
  html{-webkit-text-size-adjust:100%}body{overscroll-behavior-y:none}
  input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea{font-size:16px!important}
  /* bottom tab bar */
  .mtabs{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:900;background:color-mix(in srgb,var(--surface) 94%,transparent);backdrop-filter:saturate(1.4) blur(14px);-webkit-backdrop-filter:saturate(1.4) blur(14px);border-top:1px solid var(--line);padding:6px 4px calc(6px + env(safe-area-inset-bottom))}
  .mtabs button{flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;gap:3px;border:0;background:transparent;color:var(--muted);font:600 10.5px var(--fb);padding:6px 2px;border-radius:10px;cursor:pointer;-webkit-tap-highlight-color:transparent}
  .mtabs svg{width:23px;height:23px}.mtabs button[aria-current=page]{color:var(--accent-text,var(--accent))}.mtabs button[aria-current=page] svg{stroke-width:2.2}
  .mtabs .mdot{position:absolute;margin:-2px 0 0 14px;width:8px;height:8px;border-radius:50%;background:var(--accent)}
  .stage,.pagebar~*{scroll-padding-bottom:90px}
  .stage{padding-bottom:calc(88px + env(safe-area-inset-bottom))}
  #home,#health,#team,#contacts,#market,#comps,#feed{padding-bottom:calc(88px + env(safe-area-inset-bottom))}
  .toast-undo{bottom:calc(84px + env(safe-area-inset-bottom))}
  #toast,.toast{bottom:calc(84px + env(safe-area-inset-bottom))!important}
  /* header: title + Search + Filters */
  .pagebar{position:sticky;top:0;z-index:700;background:var(--bg);padding-top:calc(10px + env(safe-area-inset-top))}
  .mact{display:none}
  #mFilters:not([hidden]){display:inline-flex;align-items:center;justify-content:center;gap:6px}
  #mFilters svg{width:19px;height:19px}#mFilters .dot{background:var(--accent);color:var(--on-accent);border-radius:999px;font-size:11px;min-width:18px;height:18px;display:inline-flex;align-items:center;justify-content:center;padding:0 5px}
  .ptitle{flex:1 1 auto}.ptools{order:5}
  /* panels (listing, requirements, favorites, dossier, assistant) take the whole screen */
  .panel{width:min(92vw,440px);max-width:92vw;border-left:1px solid var(--line)}
  .side{width:min(204px,62vw)}
  .panel .phead{position:sticky;top:0;z-index:3;background:var(--surface);padding-top:calc(10px + env(safe-area-inset-top))}
  .panel .pbody{padding-bottom:calc(24px + env(safe-area-inset-bottom));-webkit-overflow-scrolling:touch}
  .x{width:42px;height:42px}
  /* the listing's main action stays on screen */
  #dBody .act:has(>#send){position:sticky;bottom:0;z-index:5;background:var(--surface);margin:0 -16px;padding:10px 16px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--line)}
  #dBody .act:has(>#send)>#send{width:100%;height:46px;display:flex;align-items:center;justify-content:center;font-size:15px}
  #dBody .act button,#dBody .act a{min-height:42px}
  /* sidebar = full menu by default; Filters and Search open it as a sheet */
  .side{height:100dvh;bottom:auto;overflow:hidden;padding-bottom:calc(16px + env(safe-area-inset-bottom))}
  .sheet-filters .side{top:auto;bottom:0;height:auto;max-height:88dvh;width:100%;border-radius:20px 20px 0 0;transform:translateY(105%)}
  .navopen.sheet-filters .side{transform:none}
  .sheet-filters .side>*:not(.side-scroll):not(.side-top){display:none}.sheet-filters .side-scroll .nav{display:none}.sheet-filters .side-top .brand{display:none}.sheet-filters .side-top{padding:6px 10px 0;justify-content:flex-end;min-height:0}
  .sheet-filters #fDone{position:sticky;bottom:0;width:100%;height:48px;margin-top:12px;box-shadow:0 16px 0 16px var(--surface)}
  .sheet-filters #sideCtx{padding-bottom:20px}
  .sheet-filters #sideCtx{border-top:0;padding-top:0}
  body:not(.sheet-filters) .side #sideCtx{display:none}
  .hlhead{flex-direction:column;align-items:flex-start;gap:10px}.hlhead .faint{font-size:13px}
  .pagebar .menubtn{order:0}.pagebar .ptitle{order:1;flex:1 1 0;min-width:0}
  .pagebar .gsearch{order:2;flex:1 1 100%;min-width:0;margin:0}.pagebar .gsearch input{height:42px}.pagebar .ptools{order:3}
  .tgroup #mFilters{flex:none}
  .sideclose{align-items:center;justify-content:center;line-height:1;font-size:22px;padding:0}
  /* wide tables become stacked cards (labels come from the column headers, see mobile.js) */
  .stage .pcard{overflow:visible}
  .stage .tbl:not(.cmp){min-width:0;display:block}.stage .tbl:not(.cmp) thead{display:none}.stage .tbl:not(.cmp) tbody{display:block}
  .stage .tbl:not(.cmp) tr{display:grid;grid-template-columns:1fr 1fr;gap:6px 14px;padding:12px 6px;border-bottom:1px solid var(--line)}
  .stage .tbl:not(.cmp) td{display:block;border:0;padding:0;white-space:normal;min-width:0;overflow-wrap:anywhere;text-align:left!important}
  .stage .tbl:not(.cmp) td:empty{display:none}
  .stage .tbl:not(.cmp) td:first-child{grid-column:1/-1;font-weight:600;font-size:14.5px}
  .stage .tbl:not(.cmp) td[data-label]:not(:first-child)::before{content:attr(data-label);display:block;font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--faint);margin-bottom:1px}
  .stage .tbl:not(.cmp) td[colspan]{grid-column:1/-1}
  #leaflet{height:calc(100dvh - 300px);min-height:360px}
  .dlg{max-height:calc(100dvh - 24px)}.sx-scrim{align-items:flex-end!important;padding:0!important}.sx-scrim .dlg{width:100%;border-radius:20px 20px 0 0;max-height:92dvh}
  .sx-f{padding-bottom:calc(14px + env(safe-area-inset-bottom));flex-wrap:wrap}
  .sx-f .btn{flex:1 1 auto}
  .gbtn,.chip,.fchip,.btn{min-height:40px}
  .lgcard{padding:24px 20px}
}
@media(max-width:900px) and (orientation:landscape){.mtabs button{flex-direction:row;justify-content:center;gap:6px;font-size:11px}.mtabs svg{width:19px;height:19px}}
@media(max-width:900px){
  #tools-listing{flex-wrap:nowrap;gap:6px;max-width:100%}#tools-listing #addPropBtn{padding:0 9px;font-size:12.5px;white-space:nowrap;flex:none}
  #tools-listing select.sortsel{flex:1 1 0;width:0;min-width:0;max-width:none;padding-left:10px!important;padding-right:28px!important;background-position:calc(100% - 15px) 52%,calc(100% - 10px) 52%}
  #tools-listing #mFilters{padding:0 10px;font-size:12.5px;gap:5px;flex:none}#tools-listing #mFilters svg{width:16px;height:16px}
}
@media(max-width:900px){.pagebar .ptools,.pagebar .ptools.inline{flex:1 1 100%;width:100%;margin-left:0}.pagebar .ptools.inline .tgroup{width:100%}}

@media(max-width:600px){.hmhead .faint{display:flex;align-items:center;flex-wrap:nowrap;white-space:nowrap;gap:0}.hm-wx{margin-left:8px;padding:0;flex:none}}
.hm-wx.nocity .wxc{display:none}.hm-wx.noword small{display:none}
/* ---- compact phone pass: tighter tiles, two-up photo grid, full-width listing panel ---- */
@media(max-width:600px){
  .kpis{gap:8px;margin-bottom:12px}.kpi{padding:9px 12px!important}.kpi .k{font-size:10px}.kpi .v,.kpis.small .kpi .v{font-size:18px!important;margin-top:2px}
  .pgrid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.pinfo{padding:8px 9px 9px}.pinfo .pa{font-size:13px}.pinfo .ph{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.pinfo .pm{font-size:11.5px;margin-top:4px;flex-wrap:wrap;gap:0 6px}
  .pen{text-align:left!important;font-size:10px!important;line-height:1.3;margin-top:3px}
  .pimg .badge{top:6px;left:6px;font-size:9.5px;padding:2px 6px}
  #drawer{width:100vw!important;max-width:100vw!important;border-left:0}
  .ro .dnav span{display:none}
  .mgrid{gap:8px;margin:10px 0}.m{padding:8px 10px}.m .v{font-size:17px}.m .k{font-size:9.5px}
  .fitem{grid-template-columns:1fr!important;gap:2px;padding:9px 12px}.fthumb{display:none}.fwhen{grid-column:1!important;font-size:11.5px;color:var(--faint)}
  .fhead b{font-size:14px}
}
@media(max-width:600px){
  #drawer .pbody{padding-bottom:0!important}
  #dBody .tbtns .gbtn.tv{padding:5px 11px;font-size:12px;height:auto}
}
