:root {
  --navy: #1f3a5f;
  --bg: #ffffff;
  --text: #1b1f24;
  --muted: #6b7380;
  --line: #e4e7ec;
  --chip: #f2f4f7;
  --ai: #7c3aed;
  --hit: #0f766e;
  --stay: #1d4ed8;
  --play: #e11d48;
  --food: #ea580c;
  --shop: #9333ea;
  --etc: #475569;
  --me: #2563eb;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

#map { position: fixed; inset: 0; z-index: 0; background: #e8eef3; }

/* ── 위쪽 ── */
#top { position: fixed; top: 0; left: 0; right: 0; z-index: 20; padding: 8px 10px 6px;
  background: linear-gradient(#fff 75%, rgba(255,255,255,0)); }
#top .row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.trip-btn { font-weight: 700; font-size: 16px; padding: 4px 2px; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-btn::after { content: " ▾"; color: var(--muted); font-weight: 400; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; margin-left: auto; }
.dot.ready { background: #16a34a; }
.dot.busy { background: #f59e0b; }
.dot.off { background: #dc2626; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; font-size: 18px; display: inline-grid; place-items: center; }
.ask { display: flex; gap: 6px; }
.ask input { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border: 1.5px solid var(--navy); border-radius: 10px; background: #fff; outline: none; }
.ask button { height: 42px; padding: 0 14px; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 600; }
.ask button:disabled { opacity: .5; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 7px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; padding: 6px 11px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0,0,0,.06); white-space: nowrap; font-size: 14px; }
.chips button.on { background: var(--hit); color: #fff; border-color: var(--hit); }
.chips button.ghost { color: var(--muted); }

/* ── 내 위치 버튼 ── */
.fab { position: fixed; right: 12px; bottom: calc(76px + var(--safe-b)); z-index: 15; width: 46px; height: 46px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); font-size: 22px; color: var(--me); transition: bottom .2s; }
body.sheet-open .fab { bottom: calc(46vh + 70px + var(--safe-b)); }
body.sheet-full .fab { display: none; }

/* ── 아래 탭 ── */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b); }
#tabs button { flex: 1; height: 56px; font-size: 14px; color: var(--muted); }
#tabs button.on { color: var(--navy); font-weight: 700; }

/* ── 아래 시트 ── */
.sheet { position: fixed; left: 0; right: 0; bottom: calc(56px + var(--safe-b)); z-index: 25; background: #fff;
  border-radius: 16px 16px 0 0; box-shadow: 0 -4px 18px rgba(0,0,0,.14); display: flex; flex-direction: column;
  height: 46vh; transition: height .18s ease; }
.sheet.closed { display: none; }
.sheet.full { height: calc(100vh - 56px - var(--safe-b) - 70px); }
.sheet-head { display: flex; align-items: center; padding: 6px 8px 4px 14px; border-bottom: 1px solid var(--line); position: relative; }
.grip { position: absolute; top: -2px; left: 0; right: 0; height: 22px; }
.grip::before { content: ""; position: absolute; top: 7px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: #d0d5dd; }
.sheet-title { font-weight: 700; flex: 1; padding-top: 8px; }
.sheet-body { overflow-y: auto; padding: 8px 14px 18px; flex: 1; -webkit-overflow-scrolling: touch; }

/* ── 목록 ── */
.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.item:last-child { border-bottom: 0; }
.item .num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; }
.item .main { flex: 1; min-width: 0; }
.item .name { font-weight: 600; }
.item .sub { color: var(--muted); font-size: 13px; }
.item .acts { display: flex; gap: 6px; flex: none; }
.btn { padding: 7px 11px; border-radius: 8px; background: var(--chip); font-size: 13px; font-weight: 600; white-space: nowrap; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.danger { background: #fee2e2; color: #b91c1c; }
.btn.go { background: #e0f2fe; color: #075985; }
.filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.filter button { padding: 4px 10px; border-radius: 999px; background: var(--chip); font-size: 13px; }
.filter button.on { background: var(--navy); color: #fff; }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--chip); color: var(--muted); margin-left: 4px; vertical-align: 1px; }
.tag.ok { background: #dcfce7; color: #166534; }
.open { color: #15803d; } .closed-now { color: #b91c1c; }

/* ── AI ── */
.ai-q { color: var(--muted); font-size: 13px; margin: 2px 0 6px; }
.ai-text { white-space: pre-wrap; word-break: break-word; }
.ai-status { color: var(--ai); font-size: 13px; display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.spin { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-err { color: #b91c1c; }

/* ── 상세·폼 ── */
.detail h2 { margin: 4px 0 2px; font-size: 18px; }
.detail p { margin: 6px 0; }
.detail .acts { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.detail .acts .btn { padding: 10px 14px; font-size: 14px; }
.form label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 3px; }
.form input, .form select, .form textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.form textarea { min-height: 60px; resize: vertical; }
.form .two { display: flex; gap: 8px; } .form .two > * { flex: 1; }
.form .acts { display: flex; gap: 8px; margin-top: 14px; }
.searchbar { display: flex; gap: 6px; }
.searchbar input { flex: 1; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.day-h { font-weight: 700; margin: 12px 0 2px; display: flex; align-items: center; gap: 8px; }
.day-h .btn { margin-left: auto; }
.mini { padding: 4px 8px; font-size: 12px; }
h3 { font-size: 14px; margin: 16px 0 4px; }

/* ── 마커 ── */
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.pin > span { transform: rotate(45deg); font-size: 15px; line-height: 1; color: #fff; font-weight: 700; }
.pin.c-stay { background: var(--stay); } .pin.c-play { background: var(--play); } .pin.c-food { background: var(--food); }
.pin.c-shop { background: var(--shop); } .pin.c-etc { background: var(--etc); }
.pin.cand { opacity: .72; transform: rotate(-45deg) scale(.85); }
.pin.ai { background: var(--ai); }
.pin.hit { background: var(--hit); width: 26px; height: 26px; }
.pin.hit > span, .pin.ai > span { font-size: 13px; }
.pin.sel { transform: rotate(-45deg) scale(1.25); z-index: 1000; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--me); border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(37,99,235,.35), 0 1px 4px rgba(0,0,0,.3); }
.leaflet-div-icon { background: none; border: 0; }
.gpin { position: absolute; transform: translate(-50%, -100%); cursor: pointer; }

/* ── 알림·로그인 ── */
#toast { position: fixed; left: 50%; top: 140px; transform: translateX(-50%); z-index: 50; background: rgba(17,24,39,.9); color: #fff;
  padding: 8px 14px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.show { opacity: 1; }
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(15,23,42,.55); display: grid; place-items: center; padding: 16px; }
.login-box { background: #fff; border-radius: 14px; padding: 22px; width: 100%; max-width: 340px; display: grid; gap: 10px; }
.login-box h1 { margin: 0 0 4px; font-size: 20px; }
.login-box input { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.login-box button { padding: 12px; border-radius: 8px; background: var(--navy); color: #fff; font-weight: 700; }
