/* salon-os Sales Tool — internal AM tool, not marketing site */
:root {
  --bg: #FAF8F3;
  --ink: #15161A;
  --accent: #D4453B;
  --line: #D6D2C6;
  --muted: #6B6A65;
  --chip-bg: #ECE8DE;
  --hover: #F2EFE6;
  --selected: #FCE9E7;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
header {
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-bottom: 2px solid var(--accent);
  flex-shrink: 0;
}
header h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
header h1 .count {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Filter bar */
.filter-bar {
  position: sticky;
  top: 0;
  z-index: 500;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  flex-shrink: 0;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.filter-group label {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.filter-group select,
.filter-group input[type="text"] {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 4px 8px;
  font-family: inherit;
  font-size: 12px;
  border-radius: 3px;
  min-width: 110px;
}
.filter-group input[type="text"] {
  min-width: 180px;
}
.filter-group input[type="range"] {
  width: 110px;
  accent-color: var(--accent);
}
.filter-group .val {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  min-width: 32px;
  text-align: right;
  font-weight: 600;
}
.filter-reset {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
  font-family: inherit;
}
.filter-reset:hover { background: var(--hover); color: var(--ink); }

/* Selection bar */
.selection-bar {
  background: var(--ink);
  color: var(--bg);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.selection-bar .sel-count { font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.selection-bar button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
  font-family: inherit;
  font-weight: 500;
}
.selection-bar button:disabled {
  background: #4a4b50;
  color: #8b8c91;
  cursor: not-allowed;
}
.selection-bar button.ghost {
  background: transparent;
  border: 1px solid #4a4b50;
  color: var(--bg);
}
.selection-bar button.ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.selection-bar .stats {
  margin-left: auto;
  color: #b4b3ad;
  font-variant-numeric: tabular-nums;
}

.mobile-view-toggle {
  display: none;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  gap: 6px;
  flex-shrink: 0;
}
.mobile-view-toggle button {
  flex: 1;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 7px 10px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.mobile-view-toggle button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* Main split */
.main {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.map-wrap {
  flex: 0 0 60%;
  position: relative;
  border-right: 1px solid var(--line);
}
#map {
  position: absolute;
  inset: 0;
  background: #e8e6df;
}

.list-wrap {
  flex: 0 0 40%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}
.list-header {
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.list-header label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.list-header .right { margin-left: auto; }
.list-header select {
  background: #fff;
  border: 1px solid var(--line);
  font-size: 11px;
  padding: 2px 4px;
  font-family: inherit;
}
#list {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  align-items: start;
}
.row:hover { background: var(--hover); }
.row.selected { background: var(--selected); }
.row.active { box-shadow: inset 3px 0 0 var(--accent); }
.row input[type="checkbox"] {
  margin: 2px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.row .body { min-width: 0; }
.row .name {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row .addr {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row .meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.row .meta .rating { color: var(--accent); font-weight: 600; }
.row .meta .badge {
  background: var(--chip-bg);
  color: var(--ink);
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 500;
}
.row .meta .badge.no { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.row .quick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
}
.row .quick a, .row .quick span {
  color: var(--ink);
  text-decoration: none;
  background: var(--chip-bg);
  padding: 2px 6px;
  border-radius: 2px;
  white-space: nowrap;
}
.row .quick a:hover { background: var(--accent); color: #fff; }
.row .quick span.disabled { color: #b4b3ad; background: transparent; border: 1px dashed var(--line); }

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
  background: var(--bg);
  color: var(--ink);
  border-radius: 4px;
  border: 1px solid var(--ink);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.leaflet-popup-content { margin: 10px 12px; font-family: inherit; font-size: 12px; line-height: 1.45; }
.leaflet-popup-content .pop-name { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.leaflet-popup-content .pop-addr { color: var(--muted); margin-bottom: 6px; font-size: 11px; }
.leaflet-popup-content .pop-meta { font-size: 11px; margin-bottom: 6px; }
.leaflet-popup-content .pop-meta .rating { color: var(--accent); font-weight: 600; }
.leaflet-popup-content .pop-types {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px;
}
.leaflet-popup-content .pop-types .badge {
  background: var(--chip-bg); padding: 1px 6px; border-radius: 2px; font-size: 10px;
}
.leaflet-popup-content .pop-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.leaflet-popup-content .pop-actions a, .leaflet-popup-content .pop-actions span {
  background: var(--ink); color: var(--bg);
  padding: 4px 8px; border-radius: 3px; font-size: 11px;
  text-decoration: none; font-weight: 500;
}
.leaflet-popup-content .pop-actions a.wa { background: var(--accent); }
.leaflet-popup-content .pop-actions a:hover { opacity: 0.85; }
.leaflet-popup-content .pop-actions span.disabled { background: transparent; color: var(--muted); border: 1px dashed var(--line); }

.leaflet-popup-tip { background: var(--bg); border: 1px solid var(--ink); }

/* Marker cluster — slightly more solid look */
.marker-cluster div { background-color: rgba(212, 69, 59, 0.85); color: #fff; font-weight: 600; }
.marker-cluster { background-color: rgba(212, 69, 59, 0.35); }

footer {
  padding: 6px 12px;
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  border-top: 1px solid var(--line);
  text-align: center;
  flex-shrink: 0;
}

/* Loading */
.loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  z-index: 1000;
}

/* Mobile stacking */
@media (max-width: 800px) {
  .mobile-view-toggle { display: flex; }
  .main { flex-direction: column; }
  .map-wrap { flex: 1 1 auto; min-height: 52vh; border-right: none; border-bottom: 1px solid var(--line); }
  .list-wrap { flex: 1; }
  .main[data-view="map"] .list-wrap { display: none; }
  .main[data-view="list"] .map-wrap { display: none; }
  .filter-group input[type="text"] { min-width: 140px; }
  header h1 { font-size: 13px; }
  .filter-bar { padding: 6px 8px; gap: 6px; }
  .selection-bar { flex-wrap: wrap; }
  .selection-bar .stats { width: 100%; margin-left: 0; order: 99; }
}
@media (max-width: 560px) {
  .map-wrap { min-height: 50vh; }
  header { padding: 8px 12px; }
  header h1 { font-size: 12px; }
  .filter-bar { flex-wrap: wrap; gap: 4px; }
  .filter-group { flex: 1 1 calc(50% - 4px); }
  .filter-group label { font-size: 10px; }
  .filter-group input, .filter-group select { font-size: 12px; padding: 4px 6px; }
}
