/* 收購屋 V13.5 — responsive override layered AFTER original V12 design.
   Keep all V12 branding, illustrations and original markup unchanged. */
:root { color-scheme:light; }
*,*::before,*::after { box-sizing:border-box; }
.front,.app {min-width:0;}
.frontsplit > div,.frontpanel,.frontbar,.fcats,.frontsplit { min-width:0; }
/* Category selection is a dialog on ALL devices, not a second desktop inline list. */
.frontsplit > div:first-child > section.frontpanel:nth-of-type(2),
.frontsplit > div:first-child > section.frontpanel:nth-of-type(3) {display:none!important;}
.mobile-modal-overlay {
  display:flex!important; position:fixed!important; inset:0!important;
  z-index:9999!important; background:rgba(7,30,72,.68)!important;
  align-items:center;justify-content:center;
  padding:clamp(10px,2vw,32px);
  overscroll-behavior:contain;
}
.mobile-modal-sheet {
  display:flex!important;flex-direction:column!important;
  width:min(1060px,100%)!important;
  height:min(88dvh,920px)!important;
  height:min(88svh,920px); /* older browser fallback; dvh override below */
  max-height:calc(100dvh - 24px)!important;
  min-height:0;min-width:0;
  background:white!important; border-radius:24px!important;
  overflow:hidden!important;
  box-shadow:0 24px 75px #061c4d66!important;
}
@supports(height:1dvh){.mobile-modal-sheet{height:min(88dvh,920px)!important;}}
.mobile-modal-handle {flex:none;}
.mobile-modal-header {flex:none;gap:12px;min-width:0;}
.mobile-modal-filters {flex:none;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));}
.mobile-modal-filters label,.mobile-modal-filters select,.mobile-modal-filters input {min-width:0;max-width:100%;}
.mobile-modal-items {
  flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;
  overscroll-behavior:contain;
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,365px),1fr))!important;
  grid-auto-rows:max-content;gap:12px!important;align-content:start;
  padding:14px clamp(12px,2vw,22px)!important;
}
.mobile-modal-item {min-width:0;margin:0!important;}
.mobile-modal-item-main {min-width:0;overflow-wrap:anywhere;}
.mobile-modal-item-main strong {overflow-wrap:anywhere;}
.mobile-modal-price {font-variant-numeric:tabular-nums;}
.mobile-modal-footer {flex:none;min-width:0;flex-wrap:wrap;gap:8px;}
.mobile-modal-footer button {max-width:100%;}
body.modal-locked {overflow:hidden!important;}
/* Generic admin editor + public request dialogs: dynamic viewport, no content escapes. */
.dialogbg,.request-overlay,.request-modal-overlay {
  position:fixed;max-width:100vw;max-height:100dvh;
  overflow-y:auto;overscroll-behavior:contain;
  padding:clamp(8px,2vw,24px);
}
.dialog,.request-modal {
  width:min(700px,100%)!important;max-width:100%!important;
  max-height:calc(100dvh - 2 * clamp(8px,2vw,24px))!important;
  overflow:auto!important;overscroll-behavior:contain;
  padding:clamp(15px,2vw,28px)!important;
}
.dialog input,.dialog select,.dialog textarea,.request-modal input,.request-modal select,.request-modal textarea {
  max-width:100%!important; min-width:0; width:100%;
}
.editor,.backup-grid,.setgrid {grid-template-columns:repeat(2,minmax(0,1fr));}
.request-buttons,.actions,.top-right {flex-wrap:wrap;}
.scrolltable {max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;}
.frontbar {flex-wrap:wrap;}
@media (max-width:800px) {
  .mobile-modal-overlay {align-items:flex-end!important;padding:0!important;}
  .mobile-modal-sheet {width:100%!important;height:min(94dvh,950px)!important;max-height:100dvh!important;border-radius:23px 23px 0 0!important;}
  .mobile-modal-filters {grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
  .mobile-modal-items {grid-template-columns:minmax(0,1fr)!important;gap:10px!important;}
  .mobile-modal-footer {padding-bottom:calc(12px + env(safe-area-inset-bottom,0px));}
  .dialog,.request-modal{width:100%!important;}
}
@media (max-width:600px){
  .editor,.backup-grid,.setgrid{grid-template-columns:minmax(0,1fr)!important;}
  .mobile-modal-header h2{font-size:clamp(19px,6vw,26px);}
  .mobile-modal-filters{padding:10px 12px;}
  .mobile-modal-filters select,.mobile-modal-filters input{font-size:16px;}
  .mobile-modal-header{padding:8px 12px;}
  .mobile-modal-item{grid-template-columns:minmax(0,1fr) auto;}
  .mobile-modal-price{font-size:clamp(15px,4.5vw,19px);}
}
@media(max-width:360px){
  .mobile-modal-item{grid-template-columns:minmax(0,1fr);}
  .mobile-modal-price{grid-column:1;}
  .mobile-modal-add{grid-column:1!important;}
  .mobile-modal-footer button{width:100%;}
}
@media(max-height:560px) and (min-width:801px){
  .mobile-modal-sheet{height:calc(100dvh - 16px)!important;max-height:calc(100dvh - 16px)!important;}
  .mobile-modal-overlay{padding:8px!important;}
  .mobile-modal-header{padding-top:5px;padding-bottom:5px;}
  .mobile-modal-filters{padding-top:8px;padding-bottom:8px;}
}
@media(prefers-reduced-motion:reduce){.mobile-modal-overlay *, .mobile-modal-overlay *::before{scroll-behavior:auto!important;transition-duration:.01ms!important;}}
