:root{font-family:system-ui,-apple-system,"PingFang TC","Microsoft JhengHei",sans-serif;color:#142c43;background:#f2f6fa;font-size:16px;--green:#08765c;--orange:#a6540b}*{box-sizing:border-box}body{margin:0}header{background:#122940;color:white;padding:28px 0 24px}.wrap{max-width:1120px;margin:auto;padding:0 20px}h1{font-size:clamp(28px,5vw,40px);margin:8px 0}h2{font-size:22px;margin:12px 0}h3{font-size:18px}.eyebrow{letter-spacing:2px;color:#87d9cc;font-size:14px}p{line-height:1.65}button,input,select,textarea{font:inherit}button,.filebtn{border:1px solid #c6d2de;border-radius:10px;background:white;color:#142c43;padding:11px 15px;min-height:46px;cursor:pointer;font-weight:650;touch-action:manipulation}button:hover{border-color:#08765c}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #e0a521;outline-offset:2px}.primary{background:#08765c;color:white;border-color:#08765c}.danger{color:#a33333;border-color:#d5a7a7}button:disabled{opacity:.4;cursor:default}input,select,textarea{width:100%;border:1px solid #c2cfd9;border-radius:8px;padding:10px;background:white;color:#142c43;min-height:46px}select{appearance:none;background-image:linear-gradient(45deg,transparent 50%,#385269 50%),linear-gradient(135deg,#385269 50%,transparent 50%);background-position:calc(100% - 18px) 20px,calc(100% - 13px) 20px;background-size:5px 5px;background-repeat:no-repeat;padding-right:30px}label{display:block;font-size:14px;font-weight:650}label input,label select,label textarea{margin-top:6px}.savebar{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;padding:14px 0;font-size:14px;color:#52697c}.summary{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.stat{background:white;border:1px solid #dbe4ec;border-radius:13px;padding:15px}.stat b{display:block;font-size:28px;margin-top:3px}.next{background:#e2f4ec;border:1px solid #9fcfba;border-radius:16px;margin:16px 0;padding:20px}.next h2{margin:5px 0}.next .eyebrow{color:#07634d}.ticket{display:flex;gap:12px;flex-wrap:wrap;font-size:15px}.ticket span{background:#243f56;border-radius:7px;padding:7px 10px}nav{display:flex;gap:8px;overflow:auto;position:sticky;top:0;background:#f2f6faf5;padding:12px 0;z-index:3}nav button{white-space:nowrap}nav .active{background:#142e46;color:white;border-color:#142e46}.filters{display:grid;grid-template-columns:1.2fr 1fr 1.3fr 1fr .8fr;gap:10px;padding:14px 0}.line{display:flex;justify-content:space-between;align-items:center;gap:12px}.muted{color:#52697c;font-size:14px}.card{display:grid;grid-template-columns:55px 1fr auto;gap:13px;background:white;border:1px solid #dae4ec;border-left:5px solid var(--green);border-radius:12px;padding:16px;margin:12px 0}.card.sold{border-left-color:#8897a4;background:#e8edf1}.card.sold h3{text-decoration:line-through}.card.hold{border-left-color:#c67720;background:#fff8e9}.rank{font-size:23px;font-weight:750;color:#517184}.card h3{font-size:21px;margin:0 0 5px}.badge{display:inline-block;border-radius:5px;background:#e5f5ee;color:#08654d;font-size:14px;padding:3px 7px;margin:3px 4px 3px 0}.sold .badge{background:#dce3e9;color:#536574}.hold .badge{background:#fff0d0;color:#94520e}.metrics{display:flex;gap:10px 24px;flex-wrap:wrap;margin-top:12px}.metrics span{font-size:14px;color:#536879}.metrics b{display:block;font-size:18px;color:#142c43;margin-top:2px}.cardActions{display:flex;flex-direction:column;gap:8px;min-width:112px}.small{font-size:14px}.panel{background:white;border:1px solid #dbe4ec;border-radius:14px;padding:22px;margin:16px 0}.analysis{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}.analysis article{background:#edf5fa;border-radius:10px;padding:15px}.analysis p{margin-bottom:0}.formgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.formgrid .formgrid{grid-column:1/-1;grid-template-columns:repeat(3,1fr)}.actions{display:flex;gap:10px;flex-wrap:wrap;margin:12px 0}.filebtn{display:inline-flex;align-items:center}.gridscroll{overflow:auto;background:white;border-radius:12px}table{border-collapse:collapse;width:100%;font-size:14px}th,td{padding:10px;border-bottom:1px solid #dde5ed;text-align:left}th{background:#e7eef5;position:sticky;top:0}td button{width:100%;min-width:112px;text-align:left;font-size:14px;background:#e5f5ee;border-color:#b4d9ca}td button.sold{background:#e2e7ec;color:#687b89;text-decoration:line-through}td button.hold{background:#fff0d0;color:#94520e}.mapscroll{overflow:auto;margin-top:15px}.mapscroll img{width:100%;min-width:1000px;display:block}footer{text-align:center;color:#52697c;padding:30px 20px 60px;font-size:14px}dialog{border:0;border-radius:16px;max-width:520px;width:calc(100% - 28px);padding:24px;max-height:90vh;overflow:auto}dialog::backdrop{background:#0c233a99}dialog label{margin:12px 0}.check{display:flex;gap:10px;align-items:center}.check input{width:22px;min-height:22px;margin:0}#toast{display:none;position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#142c43;color:white;padding:12px 22px;border-radius:12px;z-index:20;max-width:90vw}#toast.show{display:block}a{color:#006d83}#history p{border-bottom:1px solid #dbe4ec;padding:8px 0}#count{font-size:16px;font-weight:400}@media(max-width:760px){.wrap{padding:0 14px}.filters{grid-template-columns:1fr 1fr}.filters label:first-child{grid-column:1/-1}.summary{gap:7px}.stat{padding:12px;font-size:14px}.stat b{font-size:24px}.card{grid-template-columns:35px 1fr;padding:13px;gap:8px}.cardActions{grid-column:2;flex-direction:row;flex-wrap:wrap}.cardActions button{flex:1;white-space:nowrap}.rank{font-size:20px}.metrics{gap:9px 17px}.analysis{grid-template-columns:1fr}.panel{padding:16px}.formgrid .formgrid{grid-template-columns:1fr 1fr}nav button{padding:10px 12px}.ticket{gap:6px}.ticket span{font-size:14px}.formgrid{grid-template-columns:1fr}.savebar{font-size:13px}.next{padding:16px}}@media print{header{background:white;color:black}.ticket span{background:#eee}nav,.filters,.cardActions,.savebar,#settingsView,#mapView,#gridView,footer,#undo{display:none!important}#listView{display:block!important}.card{break-inside:avoid;grid-template-columns:40px 1fr}.next{background:white}.wrap{max-width:none}body{background:white}}

.planScroll{overflow:auto;border:1px solid #d0dbe5;border-radius:12px}.plan{position:relative;min-width:800px;width:100%}.plan img{display:block;width:100%}.hotspot{position:absolute;transform:translate(-50%,-50%);border:3px solid white;background:#063f37;color:white;border-radius:50%;padding:0;min-height:32px;width:32px;height:32px;font-size:15px;box-shadow:0 2px 8px #132f45;font-weight:800}

.quickfilters{grid-column:1/-1;background:#e7f2f3;border:1px solid #bfd9da;border-radius:12px;padding:14px}.quickfilters p{font-size:14px;margin:5px 0}.quickfilters .actions{margin-bottom:0}

.rank{font-size:15px;line-height:1.7;min-width:62px}.rank small{display:block;font-size:12px;font-weight:400;color:#536879}.card{grid-template-columns:70px 1fr auto}.quickfilters button.selected{background:#08765c;color:white;border-color:#08765c}#filterFeedback{font-weight:700;color:#075c4a}@media(max-width:760px){.card{grid-template-columns:65px 1fr}}

/* Freeze both axes inside the floor chooser, including on mobile Safari. */
#gridView .gridscroll{max-height:70vh;max-height:70dvh;overflow:auto;position:relative;isolation:isolate;-webkit-overflow-scrolling:touch;border:1px solid #cad7e2;overscroll-behavior:contain}
#gridView table{border-collapse:separate;border-spacing:0;min-width:700px}
#gridView thead th{position:sticky;top:0;z-index:4;background:#e7eef5;box-shadow:0 2px 0 #bacbd9}
#gridView tbody th{position:sticky;left:0;top:auto;z-index:3;background:#e7eef5;min-width:66px;border-right:2px solid #b8cbd9;box-shadow:2px 0 0 #d0dce6}
#gridView thead th:first-child{left:0;z-index:5;min-width:66px;border-right:2px solid #b8cbd9}
#gridView td{background:#fff}
@media(max-width:760px){#gridView .gridscroll{max-height:65vh;max-height:65dvh}}

#gridView td{padding:8px;min-width:168px;vertical-align:top}.floorCell{position:relative;padding-right:0}#gridView .unitToggle{padding:12px 42px 12px 10px;min-width:150px;min-height:112px;line-height:1.55;white-space:nowrap}#gridView .unitToggle.available{background:#d7f2e3;border:2px solid #239363;color:#064c30}#gridView .unitToggle.sold{background:#fbe0e0;border:2px solid #c73535;color:#8d1717;text-decoration:none}#gridView .heart{position:absolute;right:4px;top:4px;width:40px;min-width:40px;min-height:44px;height:44px;padding:0;background:#ffffffeb;border:1px solid #bacad6;color:#516c7e;font-size:28px;text-align:center}#gridView .heart.hearted{background:#fff1f4;color:#c12651;border-color:#d997ac}

.compactFilters{display:flex;gap:8px;align-items:center;flex-wrap:wrap;padding:8px 0}.compactFilters span{font-size:14px}.compactFilters button.selected{background:#08765c;color:white;border-color:#08765c}.calcInputs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.calcResults{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:16px}.calcResults>div{background:#edf5fa;border:1px solid #d5e4ef;border-radius:10px;padding:12px}.calcResults span{font-size:14px}.calcResults strong{display:block;font-size:21px;margin-top:6px;color:#075d4a}.mortgageCalc{margin:14px 0}.mortgageCalc h2{margin-top:0}@media(max-width:760px){.calcInputs,.calcResults{grid-template-columns:repeat(2,minmax(0,1fr))}.calcResults strong{font-size:20px}}

.calcUnit{background:#e1f2ec;color:#07583d;font-weight:750;border-left:4px solid #08765c;padding:9px 12px}.calcResults .monthlyHighlight{background:#073f36;color:white;border:2px solid #08765c;grid-column:span 2;grid-row:1;padding:18px 20px;box-shadow:0 3px 10px #0c40341a}.calcResults .monthlyHighlight span{font-size:17px;font-weight:700}.calcResults .monthlyHighlight strong{font-size:38px;color:#fff;letter-spacing:.5px}.unitChoice{border:0;padding:0;background:transparent;text-align:left;color:#075f64;min-height:44px;font-size:21px}.unitChoice.calculating{color:#075d4a;text-decoration:underline}.unitChoice small{font-size:14px;display:inline-block}#gridView .gridCalculate{margin-top:5px;min-height:44px;width:100%;background:#edf4fa;color:#075b70;border:1px solid #9db7c7;text-align:center;padding:6px;font-size:14px}.paymentFlash{animation:paymentPulse .7s ease}@keyframes paymentPulse{50%{box-shadow:0 0 0 6px #efb83f99}}@media(prefers-reduced-motion:reduce){.paymentFlash{animation:none}}

#gridView td{min-width:204px;padding:8px}#gridView .unitToggle{min-width:188px;min-height:176px;white-space:normal;padding:10px 10px 12px;text-align:left}#gridView .gridRank{display:flex;align-items:center;justify-content:space-between;gap:8px;width:calc(100% - 38px);min-width:122px;background:#ffda28;border:2px solid #9b6900;color:#201600;border-radius:9px;padding:5px 8px;box-shadow:0 2px 0 #ad7700}#gridView .gridRank>span{font-size:16px;font-weight:900;white-space:nowrap}#gridView .gridRank>strong{font-size:36px;font-weight:950;line-height:1.12;letter-spacing:-1px}#gridView .gridPrice{display:block;font-size:25px;line-height:1.4;margin:10px 0 4px;white-space:nowrap}#gridView .gridStatus{display:block;font-size:20px;font-weight:800}#gridView .heart{top:10px;right:6px;width:44px;min-width:44px;height:48px;font-size:32px}#gridView .gridCalculate{font-size:17px;min-height:46px;font-weight:750}#gridView thead th{font-size:18px;padding:12px 10px}#gridView tbody th{font-size:23px;text-align:center;min-width:72px}#gridView .gridscroll{max-height:76vh;max-height:76dvh}

/* Compact row-by-row mobile floor chooser; desktop retains larger cards. */
@media(max-width:760px){
 #gridView .gridscroll{max-height:72vh;max-height:72dvh;scroll-snap-type:y proximity;scroll-padding-top:66px;overscroll-behavior-y:contain}
 #gridView table{min-width:0;width:max-content;table-layout:fixed}
 #gridView thead th{font-size:14px;padding:8px 4px;line-height:1.45;height:62px;min-width:124px;width:124px}
 #gridView thead th:first-child,#gridView tbody th{min-width:48px;width:48px;max-width:48px;padding:5px 2px;font-size:18px}
 #gridView tbody tr{scroll-snap-align:start;scroll-margin-top:0}
 #gridView td{min-width:124px;width:124px;max-width:124px;padding:4px;vertical-align:top}
 #gridView .floorCell{display:grid;grid-template-columns:1fr 40px;gap:3px}
 #gridView .unitToggle{grid-column:1/-1;min-width:0;width:116px;min-height:92px;padding:5px;line-height:1.3;border-radius:7px}
 #gridView .gridRank{width:100%;min-width:0;padding:2px 5px;gap:4px;border-width:1px;border-radius:5px;box-shadow:none}
 #gridView .gridRank>span{font-size:13px}#gridView .gridRank>strong{font-size:24px}
 #gridView .gridPrice{font-size:17px;line-height:1.3;margin:4px 0 1px}
 #gridView .gridStatus{font-size:14px}
 #gridView .heart{position:static;min-width:40px;width:40px;height:40px;min-height:40px;padding:0;font-size:27px;grid-column:2;grid-row:2;line-height:1}
 #gridView .gridCalculate{margin:0;grid-column:1;grid-row:2;min-width:0;width:100%;height:40px;min-height:40px;padding:2px;font-size:14px}
 #gridView h2{font-size:20px}#gridView>p{font-size:14px;margin:8px 0}
 nav{padding:8px 0;gap:6px}nav button{font-size:14px;padding:8px 10px;min-height:42px}
}
@media print{#calculatorView{display:none!important}}

.jumpBest{position:fixed;right:max(18px,env(safe-area-inset-right));bottom:max(18px,env(safe-area-inset-bottom));z-index:15;background:#075c4a;color:#fff;border:2px solid #fff;box-shadow:0 4px 20px #102d4666;border-radius:16px;padding:12px 18px;min-height:60px;text-align:left}.jumpBest>span{display:block;font-size:18px;font-weight:850}.jumpBest>small{display:block;font-size:14px;margin-top:3px;color:#d8ffec}#gridView{padding-bottom:100px}#gridView .jumpTarget{outline:4px solid #0864c8;outline-offset:1px;border-radius:9px;box-shadow:0 0 0 7px #0864c826}@media(max-width:760px){.jumpBest{right:12px;padding:10px 14px;bottom:max(12px,env(safe-area-inset-bottom))}.jumpBest>span{font-size:17px}}@media print{.jumpBest{display:none!important}}

/* Primary navigation stays prominent; shortlist filters remain secondary. */
nav{gap:9px;padding:12px 0}nav button{font-size:19px;font-weight:800;min-height:54px;padding:12px 18px;border-radius:12px}
.compactFilters{gap:6px;padding:5px 0}.compactFilters button{font-size:14px;min-height:34px;padding:5px 11px;border-radius:7px;font-weight:650}.compactFilters span{font-size:13px;font-weight:400}
[hidden]{display:none!important}
@media(max-width:760px){nav{gap:7px;padding:10px 0}nav button{font-size:18px;min-height:52px;padding:11px 15px}.compactFilters button{font-size:13px;min-height:34px;padding:5px 10px}.compactFilters span{font-size:13px}}
