:root {
  --accent: #5b45d6;
  --accent-2: #7c5cff;
  --accent-soft: #eeeafd;
  --text: #1d1d24;
  --muted: #6d6d7a;
  --line: #e6e6ec;
  --bg: #f4f4f7;
  --card: #ffffff;
  --danger: #d0453f;
  --ok: #2f9e5e;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(20, 20, 40, .12), 0 1px 3px rgba(20, 20, 40, .08);
  --rail-w: 92px;
  --panel-w: 380px;
  --drawer-w: 340px;
  --gap: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
svg.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
i[data-icon] { display: inline-flex; }

/* ---------- cards & buttons ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.icon-btn {
  border: 0; background: transparent; width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; color: #3a3a48; position: relative;
}
.icon-btn:hover { background: #f0f0f5; }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); }
.icon-btn.sq { width: 48px; height: 48px; }
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 14px;
  font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
.btn:hover { background: #f6f6f9; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #4b37c2; }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.badge {
  position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; border-radius: 9px;
  background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px;
}

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: #44444f; margin: 12px 0 0; }
input[type=text], input[type=search], input[type=password], input[type=url], input[type=number], input[type=date], input[type=time],
input:not([type]), select, textarea {
  width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; font-size: 15px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(124, 92, 255, .15); }
textarea { resize: vertical; min-height: 70px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { min-width: 0; }
.grow { flex: 1; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 20% 10%, #e9e4ff, transparent 50%), radial-gradient(circle at 90% 90%, #ffe3f0, transparent 45%), var(--bg); }
.login-card { width: 100%; max-width: 360px; background: #fff; padding: 30px 26px; border-radius: 20px; box-shadow: var(--shadow); }
.login-card h1 { margin: 12px 0 2px; font-size: 26px; }
.login-card p { margin: 0 0 8px; }
.login-logo img { width: 56px; height: 56px; }
.login-card .btn { margin-top: 10px; padding: 12px; }

/* ---------- layout ---------- */
#app { position: fixed; inset: 0; }
#map { position: absolute; top: 0; bottom: 0; right: 0; left: var(--rail-w); background: #eceae6; }
#rail {
  position: absolute; left: 0; top: 0; bottom: 0; width: var(--rail-w); background: #fff; z-index: 600;
  display: flex; flex-direction: column; align-items: center; padding: 18px 0 18px; gap: 6px; border-right: 1px solid var(--line);
}
.rail-logo img { width: 46px; height: 46px; margin-bottom: 14px; }
.rail-btn {
  border: 0; background: transparent; width: 80px; padding: 10px 4px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13.5px; color: #3a3a48;
}
.rail-btn svg.ic { width: 24px; height: 24px; }
.rail-btn:hover { background: #f3f3f7; }
.rail-btn.active { color: var(--accent); background: var(--accent-soft); }
.rail-spacer { flex: 1; }
.rail-add {
  border: 0; width: 76px; height: 76px; border-radius: 14px; background: var(--accent); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 14px;
  box-shadow: 0 6px 16px rgba(91, 69, 214, .35);
}
.rail-add svg.ic { width: 26px; height: 26px; }
.rail-add:hover { background: #4b37c2; }
.rail-add-mobile { display: none; }

#titlecard {
  position: absolute; z-index: 500; top: var(--gap); left: calc(var(--rail-w) + var(--gap));
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; width: 340px;
}
.tc-logo img { width: 46px; height: 46px; display: block; }
.tc-text { flex: 1; min-width: 0; }
.tc-title { font-weight: 700; font-size: 19px; }
.tc-sub { color: #4a4a57; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#toolbar {
  position: absolute; z-index: 500; top: var(--gap); left: 50%; transform: translateX(-50%);
  margin-left: calc(var(--rail-w) / 2); display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; width: min(440px, 34vw);
}
#toolbar input { border: 0; box-shadow: none; margin: 0; padding: 8px 4px; background: transparent; }
.tb-search-ic { color: var(--muted); }
.tb-sep { width: 1px; height: 26px; background: var(--line); }
#topright { position: absolute; z-index: 500; top: var(--gap); right: var(--gap); display: flex; gap: 10px; align-items: center; }
.avatar-btn {
  width: 48px; height: 48px; border-radius: 12px; border: 0; color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: var(--shadow); background: var(--accent);
}
.avatar { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }

.menu {
  position: absolute; top: calc(100% + 8px); right: 0; background: #fff; border-radius: 12px; box-shadow: var(--shadow);
  min-width: 220px; padding: 6px; z-index: 900; max-height: 60vh; overflow: auto;
}
#titlecard .menu { left: 0; right: auto; width: 100%; }
#toolbar .menu { right: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 10px; border-radius: 8px; text-align: left; font-size: 14.5px; }
.menu-item:hover { background: #f4f4f8; }
.menu-item.on { color: var(--accent); font-weight: 600; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.menu-head { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px 4px; }

/* ---------- right panel ---------- */
.panel {
  position: absolute; z-index: 550; top: calc(var(--gap) + 66px); right: var(--gap); width: var(--panel-w);
  max-height: calc(100% - var(--gap) * 2 - 66px - 70px); display: flex; flex-direction: column; gap: 12px;
  transition: right .25s ease;
}
body.cal-open .panel { right: calc(var(--drawer-w) + var(--gap)); }
.pcard { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; }
.pcard.fill { flex: 1 1 auto; }
.phead { display: flex; align-items: center; gap: 10px; padding: 14px 12px 14px 18px; border-bottom: 1px solid var(--line); }
.phead h2 { margin: 0; font-size: 18px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbody { padding: 6px 18px 18px; overflow: auto; -webkit-overflow-scrolling: touch; }
.pfoot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.grab { display: none; }
.field { margin-top: 16px; }
.field .k { font-size: 14px; font-weight: 600; color: #2e2e38; }
.field .v { font-size: 15px; color: var(--muted); margin-top: 4px; word-break: break-word; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tabs { display: flex; gap: 4px; padding: 10px 14px 0; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }

.selected-chip {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 12px; border-radius: 10px; background: var(--accent-soft);
  font-weight: 500;
}
.cat-dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; flex: none; background: var(--c, #7c5cff); box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); }
.cat-dot.sm { width: 26px; height: 26px; font-size: 13px; }

/* hours table */
.hours { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 6px; }
.hours td { padding: 4px 0; color: var(--muted); }
.hours tr.today td { color: var(--text); font-weight: 600; }
.hours td:first-child { width: 48px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.status.open { background: #e2f5ea; color: var(--ok); }
.status.closed { background: #fbe6e5; color: var(--danger); }
.status.unknown { background: #f0f0f4; color: var(--muted); }

.links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.link-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 20px; background: #f2f2f6; color: var(--text); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.link-chip:hover { background: var(--accent-soft); color: var(--accent); }

/* rating */
.stars { display: inline-flex; gap: 2px; }
.stars button { border: 0; background: none; padding: 2px; font-size: 26px; line-height: 1; color: #d6d6de; }
.stars button.on { color: #f5a623; }
.stars.sm { font-size: 14px; color: #f5a623; letter-spacing: 1px; }
.stars.sm .off { color: #d6d6de; }
.rate-label { font-size: 13px; color: var(--muted); margin-left: 8px; }
.rating-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.rating-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.rating-row .name { flex: 1; }

/* list */
.place-list { display: flex; flex-direction: column; margin: 0 -10px; }
.place-item { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 10px; border: 0; background: none; text-align: left; width: 100%; }
.place-item:hover { background: #f5f5f9; }
.place-item .t { font-weight: 600; font-size: 15px; }
.place-item .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: 14px; }
.list-tools { display: flex; gap: 8px; margin: 12px 0 8px; align-items: center; }
.list-tools select { margin: 0; padding: 7px 10px; font-size: 14px; }

/* place form */
.hours-edit { width: 100%; border-collapse: collapse; margin-top: 6px; }
.hours-edit td { padding: 3px 2px; font-size: 13.5px; }
.hours-edit input[type=time] { margin: 0; padding: 6px 6px; font-size: 14px; }
.hours-edit tr.closed input[type=time] { opacity: .35; pointer-events: none; }
.geo-results { margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.geo-results button { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 9px 12px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.geo-results button:last-child { border-bottom: 0; }
.geo-results button:hover { background: var(--accent-soft); }
.loc-status { font-size: 13px; margin-top: 6px; }
.loc-status.ok { color: var(--ok); }
.loc-status.no { color: var(--danger); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 4px; margin-top: 6px; }
.emoji-grid button { border: 1px solid var(--line); background: #fff; border-radius: 8px; height: 36px; font-size: 18px; }
.emoji-grid button.on { border-color: var(--accent); background: var(--accent-soft); }
.subcard { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px 14px; margin-top: 10px; background: #fbfbfd; }
input[type=color] { width: 46px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-top: 5px; }

/* toggles */
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d5d5de; border-radius: 26px; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.person .n { font-weight: 600; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: #e2f5ea; color: var(--ok); margin-top: 3px; }
.pill.grey { background: #f0f0f4; color: var(--muted); }
.pill.purple { background: var(--accent-soft); color: var(--accent); }

/* ---------- calendar drawer ---------- */
.drawer {
  position: absolute; z-index: 700; top: 0; right: 0; bottom: 0; width: var(--drawer-w); background: #fff;
  box-shadow: -8px 0 30px rgba(20,20,40,.12); transform: translateX(105%); transition: transform .25s ease;
  display: flex; flex-direction: column; padding: 0 16px calc(16px + var(--safe-b));
}
body.cal-open .drawer { transform: none; }
body.cal-open #topright { right: calc(var(--drawer-w) + var(--gap)); }
#topright { transition: right .25s ease; }
.drawer-head { display: flex; align-items: center; padding: 16px 0 8px; }
.drawer-head h2 { margin: 0; flex: 1; font-size: 19px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; }
#calMonth { font-weight: 700; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-top: 8px; }
.cal-dow { font-size: 11.5px; text-align: center; color: var(--muted); font-weight: 600; padding: 4px 0; }
.cal-cell {
  border: 0; background: #f7f7fa; border-radius: 9px; aspect-ratio: 1 / 1; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-start; padding-top: 6px; font-size: 13.5px; gap: 3px; position: relative;
}
.cal-cell.other { background: transparent; color: #b8b8c4; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent-2); font-weight: 700; }
.cal-cell.sel { background: var(--accent); color: #fff; }
.cal-dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; max-width: 90%; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); display: block; }
.cal-cell.sel .cal-dots i { box-shadow: 0 0 0 1px #fff; }
.cal-friends { margin: 10px 0 4px; font-size: 13px; }
.cal-day { flex: 1; overflow: auto; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }
.cal-day h3 { margin: 0 0 8px; font-size: 15px; }
.event { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; background: #f7f7fa; margin-bottom: 6px; }
.event .t { font-weight: 600; font-size: 14px; cursor: pointer; }
.event .s { font-size: 12.5px; color: var(--muted); }
.event .grow { min-width: 0; }

/* ---------- map controls ---------- */
#mapctrls {
  position: absolute; z-index: 500; bottom: calc(var(--gap) + var(--safe-b)); left: 50%; transform: translateX(-50%);
  margin-left: calc(var(--rail-w) / 2); display: flex; gap: 10px; align-items: center;
}
.ctrl-group { display: flex; padding: 4px; }
.ctrl-group .icon-btn { width: 44px; height: 44px; }
.layer-label { padding: 0 18px; height: 52px; display: flex; align-items: center; font-weight: 500; cursor: pointer; }
.pick-hint {
  position: absolute; z-index: 800; top: 90px; left: 50%; transform: translateX(-50%); margin-left: calc(var(--rail-w) / 2);
  background: var(--text); color: #fff; padding: 10px 10px 10px 16px; border-radius: 30px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow);
}
#map.picking { cursor: crosshair; }

/* ---------- markers & tooltips ---------- */
.pin-wrap { background: none; border: 0; }
.pin {
  width: 38px; height: 38px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg); background: var(--c);
  display: grid; place-items: center; box-shadow: 0 3px 8px rgba(0,0,0,.3); border: 2.5px solid #fff; transition: transform .15s;
}
.pin span { transform: rotate(45deg); font-size: 17px; line-height: 1; }
.pin-wrap:hover .pin, .pin-wrap.sel .pin { transform: rotate(-45deg) scale(1.18); }
.pin-wrap.sel .pin { box-shadow: 0 0 0 4px rgba(91,69,214,.35), 0 3px 8px rgba(0,0,0,.3); }
.pin-score {
  position: absolute; top: -6px; right: -8px; background: #fff; color: #333; font-size: 10.5px; font-weight: 700; border-radius: 9px;
  padding: 1px 5px; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.draft-pin .pin { background: #1d1d24; }
.leaflet-tooltip.pin-tip {
  background: #fff; border: 0; border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; color: var(--text);
  font-family: inherit; min-width: 220px; max-width: 280px; white-space: normal;
}
.leaflet-tooltip.pin-tip::before { display: none; }
.tip-title { font-weight: 700; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.tip-cat { font-size: 12.5px; color: var(--muted); margin: 2px 0 8px; }
.tip-row { font-size: 13px; color: #44444f; margin-top: 5px; display: flex; align-items: center; gap: 6px; }
.route-num {
  width: 28px; height: 28px; border-radius: 50%; background: var(--c, var(--accent)); color: #fff; font-weight: 700; display: grid; place-items: center;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); font-size: 13px;
}
.leaflet-control-attribution { font-size: 10px; }
.leaflet-container { font-family: inherit; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 2000; background: rgba(20,20,35,.45); display: grid; place-items: center; padding: 20px; }
.modal-card { background: #fff; border-radius: 18px; box-shadow: var(--shadow); width: min(1000px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; }
.modal-card.small { width: min(420px, 100%); }
.dialog { z-index: 2100; }
.dialog .pbody { padding-top: 14px; }
.dir-layout { display: grid; grid-template-columns: 320px 1fr; min-height: 0; flex: 1; }
.dir-side { padding: 4px 18px 18px; overflow: auto; border-right: 1px solid var(--line); }
.dir-map-wrap { position: relative; min-height: 420px; display: flex; flex-direction: column; }
#dirMap { flex: 1; min-height: 360px; }
.dir-summary { display: flex; gap: 18px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: center; flex-wrap: wrap; }
.dir-summary .big { font-size: 20px; font-weight: 700; }
.stop { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; position: relative; }
.stop .route-num { flex: none; }
.stop .leg { font-size: 12px; color: var(--muted); }
.warn { background: #fff5e0; color: #8a5a00; padding: 9px 12px; border-radius: 10px; font-size: 13px; margin-top: 10px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 3000; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: #1d1d24; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; transition: .25s; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--danger); }

/* ---------- tablet ---------- */
@media (max-width: 1180px) {
  :root { --rail-w: 80px; --panel-w: 360px; }
  .rail-btn { width: 70px; font-size: 12.5px; }
  .rail-add { width: 64px; height: 64px; font-size: 13px; }
  #titlecard { width: 290px; }
  #toolbar { left: auto; right: 140px; transform: none; margin: 0; width: 280px; }
  body.cal-open #toolbar { display: none; }
  .layer-label { display: none; }
  .dir-layout { grid-template-columns: 290px 1fr; }
}
@media (max-width: 960px) {
  #toolbar { top: calc(var(--gap) + 76px); left: calc(var(--rail-w) + var(--gap)); right: auto; width: 290px; }
  .panel { top: calc(var(--gap) + 66px); }
}

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  :root { --rail-w: 0px; --gap: 10px; --drawer-w: 100vw; }
  #map { left: 0; bottom: 0; }
  #rail {
    top: auto; bottom: 0; left: 0; right: 0; width: auto; height: calc(64px + var(--safe-b)); flex-direction: row; padding: 0 6px var(--safe-b);
    justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); gap: 0; z-index: 1500;
  }
  .rail-logo, .rail-spacer, .rail-add { display: none; }
  .rail-btn { width: auto; flex: 1; padding: 8px 2px; font-size: 11px; gap: 3px; border-radius: 10px; }
  .rail-btn svg.ic { width: 22px; height: 22px; }
  .rail-add-mobile { display: flex; }
  .rail-add-mobile svg.ic { background: var(--accent); color: #fff; border-radius: 12px; width: 40px; height: 32px; padding: 5px 10px; }
  .rail-add-mobile span { display: none; }
  #titlecard { left: var(--gap); right: 70px; width: auto; padding: 6px 6px 6px 8px; gap: 8px; }
  .tc-logo img { width: 36px; height: 36px; }
  .tc-title { font-size: 16px; }
  .tc-sub { font-size: 12.5px; }
  #topright { right: var(--gap); }
  #topright #calToggle { display: none; }
  .avatar-btn { width: 50px; height: 50px; }
  #toolbar { top: calc(var(--gap) + 60px); left: var(--gap); right: var(--gap); width: auto; padding: 2px 4px 2px 12px; }
  body.cal-open #toolbar { display: flex; }
  #mapctrls { left: auto; right: var(--gap); transform: none; margin: 0; bottom: calc(76px + var(--safe-b)); flex-direction: column; gap: 8px; }
  .ctrl-group { flex-direction: column; padding: 2px; }
  .ctrl-group .icon-btn { width: 40px; height: 40px; }
  /* panel becomes a bottom sheet */
  .panel {
    top: auto; left: 0; right: 0 !important; bottom: calc(64px + var(--safe-b)); width: auto; max-height: 72vh; gap: 0; z-index: 1400;
  }
  .panel .pcard { border-radius: 18px 18px 0 0; box-shadow: 0 -6px 26px rgba(20,20,40,.16); }
  .panel .pcard + .pcard { border-radius: 0; box-shadow: none; border-top: 1px solid var(--line); }
  .panel.has-chip .pcard:first-child { display: none; }
  .grab { display: block; width: 40px; height: 5px; border-radius: 3px; background: #d5d5de; margin: 8px auto 0; }
  .phead { padding: 8px 10px 10px 16px; }
  .drawer { bottom: calc(64px + var(--safe-b)); z-index: 1450; padding-bottom: 12px; }
  body.cal-open #topright { right: var(--gap); }
  body.cal-open .drawer { box-shadow: none; }
  .pick-hint { top: auto; bottom: 150px; margin: 0; }
  .modal { padding: 0; place-items: stretch; }
  .modal-card { max-height: 100vh; height: 100%; border-radius: 0; }
  .modal.dialog { padding: 16px; place-items: center; }
  .modal.dialog .modal-card { height: auto; border-radius: 16px; }
  .dir-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow: auto; }
  .dir-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .dir-map-wrap { min-height: 380px; }
  .toast { bottom: calc(80px + var(--safe-b)); }
  .field-row { grid-template-columns: 1fr; }
}

/* ---------- v1.0.0 polish ---------- */
.panel > .pcard:not(.fill) { flex: none; }
a.btn { text-decoration: none; }
.pin-score { pointer-events: none; }
@media (min-width: 1181px) {
  body.cal-open #toolbar { left: calc(var(--rail-w) + 376px); transform: none; margin-left: 0; width: min(440px, calc(100vw - var(--rail-w) - 376px - var(--drawer-w) - 140px)); }
  body.cal-open #mapctrls, body.cal-open .pick-hint { margin-left: calc(var(--rail-w) / 2 - var(--drawer-w) / 2); }
  #toolbar, #mapctrls { transition: margin-left .25s ease; }
}

/* ---------- v1.1 logos + google ---------- */
.logo-dot { width: 34px; height: 34px; border-radius: 9px; background: #fff; box-shadow: 0 0 0 1px var(--line); display: grid; place-items: center; overflow: hidden; flex: none; }
.logo-dot.sm { width: 26px; height: 26px; border-radius: 7px; }
.logo-dot img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.pin.has-logo { background: #fff; border-color: var(--c); }
.pin.has-logo img { transform: rotate(45deg); width: 26px; height: 26px; object-fit: contain; border-radius: 50%; }
.logo-edit { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.logo-prev { width: 64px; height: 64px; border-radius: 12px; border: 1px dashed #cfcfda; display: grid; place-items: center; color: #b0b0bc; background: #fff; overflow: hidden; flex: none; }
.logo-prev img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.gbox { background: #f6f3ff; border-color: #e2dafc; margin-top: 12px; }
.gbox > label:first-child { display: block; }
.gbox label svg.ic { width: 15px; height: 15px; vertical-align: -2px; color: var(--accent); }
.geo-results button b { font-weight: 600; }
.phead .logo-dot { width: 34px; height: 34px; }
