/* ---------- Store Contacts ---------- */
#contacts { height: 100%; display: flex; flex-direction: column; }
#ctSearch { flex: 1; min-width: 0; padding: 6px 9px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.ct-filters select { flex: 1; min-width: 0; }
.ct-count { padding: 8px 14px 0; font-size: 12px; color: var(--muted); }
#ctList { overflow: auto; flex: 1; padding: 6px 8px 16px; }
.ct-row { display: block; width: 100%; text-align: left; border: 1px solid transparent; border-radius: 5px; background: none; color: inherit; font: inherit; padding: 7px 9px; cursor: pointer; }
.ct-row:hover { background: var(--head); }
.ct-row.on { background: var(--head); border-color: var(--navy); }
.ct-row small { display: block; color: var(--muted); font-size: 12px; }
.ct-sq { float: right; font-size: 11.5px; color: var(--muted); }
#ctDetail { overflow: auto; background: var(--bg); min-height: 0; }
.ct-card { max-width: 820px; margin: 16px auto; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--navy); border-radius: 4px; padding: 18px 22px 22px; }
.ct-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.ct-head h2 { margin: 0 0 2px; font-size: 19px; color: var(--title); }
.ct-back { display: none; margin-bottom: 8px; }
.ct-maplinks a.btn { text-decoration: none; }
.ct-maplinks { display: flex; gap: 8px; margin: 12px 0 4px; flex-wrap: wrap; }
.ct-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 18px; margin: 14px 0; }
.ct-facts .ct-wide { grid-column: 1 / -1; }
.ct-facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ct-facts dd { margin: 2px 0 0; }
.ct-emails { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.ct-emails li { display: flex; gap: 10px; }
.ct-emails li span { min-width: 120px; color: var(--muted); }
.ct-emails a { word-break: break-all; }
.ct-notes { white-space: pre-wrap; }
.ct-map { width: 100%; height: 300px; border: 1px solid var(--line-soft, var(--line)); border-radius: 4px; display: block; margin-top: 10px; background: var(--head); }
.ct-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 14px; margin: 14px 0; }
.ct-form label span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
.ct-form input, .ct-form textarea { width: 100%; box-sizing: border-box; padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); color: inherit; font: inherit; }
.ct-form .bad { border-color: var(--bad, #b42318); }
.ct-form p { grid-column: 1 / -1; margin: 0; font-size: 12px; }
/* map */
#contacts.ct-map #ctDetail { overflow: hidden; display: flex; flex-direction: column; }
.ct-mapwrap { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.ct-mapbar { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.ct-key { display: flex; flex-wrap: wrap; gap: 4px 14px; flex: 1; font-size: 12.5px; }
.ct-key span { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.ct-key i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .25); }
.ct-key b { color: var(--muted); font-weight: 600; }
.ct-mapzoom { display: flex; gap: 4px; }
.ct-mapzoom .btn { min-width: 34px; font-size: 16px; padding: 2px 8px; }
.ct-maplost { padding: 5px 12px; font-size: 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.ct-mapview { flex: 1; min-height: 300px; overflow: auto; background: #e8ecef; cursor: grab; position: relative; scrollbar-width: thin; }
.ct-mapview.grab { cursor: grabbing; }
.ct-canvas { position: relative; }
.ct-tiles { position: absolute; inset: 0; overflow: hidden; }
.ct-tiles img { position: absolute; width: 256px; height: 256px; max-width: none; user-select: none; pointer-events: none; }
.ct-canvas svg { position: relative; display: block; user-select: none; }
.ct-dot { stroke: #fff; stroke-width: 1.2; cursor: pointer; }
.ct-dot:hover, .ct-dot.on { stroke: #111; stroke-width: 2.5; }
.ct-pop { position: absolute; transform: translate(-50%, calc(-100% - 12px)); width: 250px; background: var(--panel); color: var(--text, inherit); border: 1px solid var(--line); border-top: 3px solid var(--navy);
  border-radius: 5px; box-shadow: 0 4px 16px rgba(0, 0, 0, .18); padding: 9px 12px 10px; font-size: 13px; display: grid; gap: 3px; cursor: default; z-index: 2; }
.ct-pop[hidden] { display: none; }
.ct-pop small { display: block; margin-top: -2px; }
.ct-popx { position: absolute; right: 7px; top: 5px; }
.ct-popbtns { display: flex; gap: 6px; margin-top: 6px; }
.ct-popbtns .btn { text-decoration: none; padding: 3px 9px; font-size: 12.5px; }
.ct-attr { position: absolute; right: 0; bottom: 0; background: rgba(255, 255, 255, .85); color: #333; font-size: 10.5px; padding: 1px 6px; text-decoration: none; }
#ctMapBtn[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
@media (max-width: 760px) {
  #contacts.ct-map.ct-open .wo-side { display: flex; max-height: none; }
  #contacts.ct-map #ctList, #contacts.ct-map .ct-count { display: none; }
  #contacts.ct-map.ct-open #ctDetail { display: flex; height: calc(100vh - 150px); }
  #contacts .wo-side { max-height: none; }
  #contacts.ct-open .wo-side { display: none; }
  #contacts:not(.ct-open) #ctDetail { display: none; }
  .ct-back { display: inline-block; }
  .ct-card { margin: 0; border-radius: 0; border-left: 0; border-right: 0; padding: 14px 16px 18px; }
  .ct-map { height: 220px; }
}
