:root{
  --bg:#0b0f17; --card:#ffffff; --ink:#111827; --sub:#6b7280; --line:#e5e7eb;
  --brand:#2563eb; --accent:#111827;
  --ok:#16a34a; --warn:#d97706; --hold:#6b7280;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
*{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body{ margin:0; height:100%; }
body{
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", sans-serif;
  color:var(--ink); background:#eef1f5; overflow:hidden;
}
#map{ position:fixed; inset:0; width:100%; height:100%; }

/* 상단 바 */
.topbar{
  position:fixed; top:0; left:0; right:0; z-index:30;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  display:flex; align-items:center; justify-content:space-between;
  background:linear-gradient(#0b0f17ee, #0b0f1700); pointer-events:none;
}
.topbar-title{ display:flex; align-items:center; gap:7px; color:#fff; pointer-events:auto; }
.topbar-title strong{ font-size:16px; letter-spacing:-0.2px; }
.logo-dot{ width:9px; height:9px; border-radius:50%; background:var(--brand); box-shadow:0 0 0 3px #2563eb44; }
.count{ font-size:12px; color:#cbd5e1; background:#ffffff1a; padding:2px 8px; border-radius:999px; }
.list-btn{
  pointer-events:auto; border:0; background:#ffffff; color:var(--ink);
  font-size:13px; font-weight:700; padding:8px 14px; border-radius:999px;
  box-shadow:0 2px 8px #0003; cursor:pointer;
}
.list-btn:active{ transform:scale(.96); }

/* 부팅 오버레이 */
.boot{ position:fixed; inset:0; z-index:60; display:flex; align-items:center; justify-content:center; background:#eef1f5; }
.boot.hidden{ display:none; }
.boot-card{ text-align:center; color:var(--sub); font-size:14px; }
.spinner{ width:34px; height:34px; border:3px solid #cdd5e0; border-top-color:var(--brand); border-radius:50%; margin:0 auto 12px; animation:spin .8s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg); } }
.boot-err{ max-width:300px; line-height:1.6; }
.boot-err b{ color:#dc2626; }

/* 지도 핀(커스텀 오버레이) */
.pin{ position:relative; transform:translate(-50%,-100%); cursor:pointer; }
.pin-body{
  background:#fff; border:2px solid var(--hold); border-radius:999px;
  padding:5px 10px; font-size:12px; font-weight:800; white-space:nowrap;
  box-shadow:0 3px 10px #0003; color:var(--ink); line-height:1;
}
.pin-body small{ display:block; font-size:9px; font-weight:600; color:var(--sub); margin-bottom:2px; }
.pin.s-검토중 .pin-body{ border-color:var(--warn); }
.pin.s-유력 .pin-body{ border-color:var(--ok); }
.pin.s-보류 .pin-body{ border-color:var(--hold); }
.pin-tail{ width:2px; height:9px; background:var(--hold); margin:0 auto; }
.pin.s-검토중 .pin-tail{ background:var(--warn); }
.pin.s-유력 .pin-tail{ background:var(--ok); }
.pin.active .pin-body{ background:var(--accent); color:#fff; transform:scale(1.06); }
.pin.active .pin-body small{ color:#cbd5e1; }

/* 공통 오버레이 딤 */
.overlay{ position:fixed; inset:0; background:#0008; z-index:38; opacity:0; pointer-events:none; transition:opacity .2s; }
.overlay.show{ opacity:1; pointer-events:auto; }

/* 바텀시트 */
.sheet{
  position:fixed; left:0; right:0; bottom:0; z-index:40;
  background:var(--card); border-radius:20px 20px 0 0;
  box-shadow:0 -6px 30px #0004; transform:translateY(101%); transition:transform .26s cubic-bezier(.2,.8,.2,1);
  max-height:82vh; overflow:auto; padding-bottom: calc(16px + var(--safe-b));
}
.sheet.show{ transform:translateY(0); }
.sheet-grip{ width:40px; height:4px; background:#d1d5db; border-radius:999px; margin:10px auto 4px; }
#sheetBody{ padding:6px 18px 4px; }

.sh-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:4px; }
.sh-name{ font-size:18px; font-weight:800; letter-spacing:-0.3px; }
.badge{ font-size:11px; font-weight:800; padding:4px 9px; border-radius:999px; white-space:nowrap; }
.badge.b-검토중{ background:#fef3c7; color:#b45309; }
.badge.b-유력{ background:#dcfce7; color:#15803d; }
.badge.b-보류{ background:#f3f4f6; color:#4b5563; }
.sh-addr{ display:flex; align-items:center; gap:8px; color:var(--sub); font-size:13px; margin:6px 0 14px; }
.sh-addr button{ border:1px solid var(--line); background:#fff; border-radius:8px; font-size:11px; padding:3px 8px; color:var(--sub); cursor:pointer; }

.money{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:14px; }
.money .cell{ background:#f8fafc; border:1px solid var(--line); border-radius:12px; padding:11px 13px; }
.money .k{ font-size:11px; color:var(--sub); margin-bottom:4px; }
.money .v{ font-size:16px; font-weight:800; letter-spacing:-0.3px; }
.money .cell.rent{ background:#eff6ff; border-color:#bfdbfe; }
.money .cell.rent .v{ color:var(--brand); }

.meta{ display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
.chip{ font-size:12px; color:#374151; background:#f3f4f6; border-radius:8px; padding:5px 10px; }
.memo{ font-size:13px; line-height:1.6; color:#374151; background:#fafafa; border:1px solid var(--line); border-radius:12px; padding:11px 13px; margin-bottom:14px; white-space:pre-wrap; }
.src{ font-size:12px; color:var(--sub); margin-bottom:14px; }

.actions{ display:flex; gap:9px; }
.btn{ flex:1; border:0; border-radius:13px; padding:14px; font-size:15px; font-weight:800; cursor:pointer; }
.btn:active{ transform:scale(.98); }
.btn.photos{ background:#f1f5f9; color:var(--ink); }
.btn.dir{ background:var(--brand); color:#fff; }
.btn[disabled]{ opacity:.45; }

/* 목록 패널 */
.list-panel{
  position:fixed; left:0; right:0; bottom:0; z-index:40; background:#fff;
  border-radius:20px 20px 0 0; box-shadow:0 -6px 30px #0004;
  height:70vh; transform:translateY(101%); transition:transform .26s cubic-bezier(.2,.8,.2,1);
  display:flex; flex-direction:column;
}
.list-panel.show{ transform:translateY(0); }
.list-head{ display:flex; align-items:center; justify-content:space-between; padding:16px 18px 10px; border-bottom:1px solid var(--line); }
.list-body{ overflow:auto; padding:8px 14px calc(16px + var(--safe-b)); }
.lcard{ display:flex; gap:12px; padding:12px; border-radius:14px; border:1px solid var(--line); margin-bottom:9px; cursor:pointer; }
.lcard:active{ background:#f8fafc; }
.lcard .lc-main{ flex:1; min-width:0; }
.lc-name{ font-weight:800; font-size:15px; margin-bottom:3px; }
.lc-addr{ font-size:12px; color:var(--sub); margin-bottom:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lc-rent{ font-size:13px; font-weight:700; color:var(--brand); }
.lc-rent span{ color:var(--sub); font-weight:600; margin-left:8px; }

.icon-btn{ border:0; background:transparent; font-size:18px; color:var(--sub); width:36px; height:36px; cursor:pointer; }

/* 사진 뷰어 */
.viewer{ position:fixed; inset:0; z-index:70; background:#000; display:none; align-items:center; justify-content:center; }
.viewer.show{ display:flex; }
.viewer-img{ max-width:100%; max-height:100%; object-fit:contain; user-select:none; }
.viewer-close{ position:absolute; top:calc(10px + var(--safe-t)); right:10px; color:#fff; font-size:22px; z-index:2; }
.viewer-nav{ position:absolute; top:50%; transform:translateY(-50%); border:0; background:#ffffff22; color:#fff; width:46px; height:46px; border-radius:50%; font-size:28px; line-height:1; cursor:pointer; }
.viewer-nav.prev{ left:12px; } .viewer-nav.next{ right:12px; }
.viewer-count{ position:absolute; bottom:calc(18px + var(--safe-b)); left:0; right:0; text-align:center; color:#fff; font-size:13px; letter-spacing:1px; }

/* 길찾기 앱 선택 */
.dirs{ position:fixed; inset:0; z-index:50; display:none; align-items:flex-end; justify-content:center; background:#0006; }
.dirs.show{ display:flex; }
.dirs-card{ width:100%; max-width:480px; background:#fff; border-radius:18px 18px 0 0; padding:14px 14px calc(14px + var(--safe-b)); }
.dirs-title{ text-align:center; font-size:13px; color:var(--sub); padding:8px 0 12px; }
.dirs-opt{ width:100%; border:0; background:#f3f4f6; border-radius:13px; padding:15px; margin-bottom:8px; display:flex; align-items:center; justify-content:space-between; cursor:pointer; }
.dirs-opt span{ font-size:16px; font-weight:800; color:var(--ink); }
.dirs-opt em{ font-style:normal; font-size:12px; color:var(--sub); }
.dirs-opt:active{ transform:scale(.98); }
.dirs-cancel{ width:100%; border:0; background:#fff; color:var(--sub); padding:14px; font-size:15px; font-weight:700; cursor:pointer; margin-top:2px; }
