*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface2: #f0eeea;
  --border: rgba(0,0,0,0.1);
  --text: #1a1a1a;
  --muted: #666;
  --accent: #c4841a;
  --red: #c0392b;
  --green: #27ae60;
  --blue: #2980b9;
  --purple: #8e44ad;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Header ─────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  z-index: 1000;
  position: relative;
}

.logo {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  letter-spacing: -0.3px;
  color: var(--accent);
}
.logo span { color: var(--text); }

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ─── Address search ──────────────────────────────── */
.address-search {
  position: relative;
}
.address-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  gap: 6px;
  transition: border-color 0.15s;
  width: 240px;
}
.address-input-wrap:focus-within {
  border-color: var(--accent);
  background: var(--surface);
}
.search-icon {
  font-size: 15px;
  color: var(--muted);
  flex-shrink: 0;
  line-height: 1;
}
.address-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  padding: 6px 0;
  outline: none;
  min-width: 0;
}
.address-input-wrap input::placeholder { color: var(--muted); }
.search-clear {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  display: none;
  flex-shrink: 0;
}
.search-clear:hover { color: var(--text); background: var(--border); }
.search-clear.visible { display: block; }

.search-suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 3000;
  list-style: none;
  overflow: hidden;
  max-height: 260px;
  overflow-y: auto;
}
.search-suggestions.visible { display: block; }
.search-suggestions li {
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
  transition: background 0.1s;
}
.search-suggestions li:last-child { border-bottom: none; }
.search-suggestions li:hover,
.search-suggestions li.focused { background: var(--surface2); }
.search-suggestions li .sug-main { font-weight: 500; }
.search-suggestions li .sug-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.search-suggestions li.sug-empty,
.search-suggestions li.sug-loading {
  color: var(--muted);
  font-style: italic;
  cursor: default;
  font-size: 12px;
}

.search-pin {
  width: 28px; height: 28px;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

/* Zone selector */
.zone-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.zone-selector select {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.zone-selector select:focus { outline: none; border-color: var(--accent); }

/* Toggle button */
.toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.toggle-btn.active { border-color: var(--accent); color: var(--accent); }
.toggle-btn:hover { background: #2e2e2e; color: #fff; }

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.15s;
}
.toggle-btn.active .dot { background: var(--accent); }

/* Panel button */
.panel-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.panel-btn:hover { background: #2e2e2e; color: #fff; }
.panel-btn.open { border-color: var(--accent); color: var(--accent); }

.badge {
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  display: inline-block;
}

/* ─── Overlay / Upload Panels ─────────────────── */
.panel-anchor {
  position: relative;
}

.overlay-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 2000;
  display: none;
  flex-direction: column;
  max-height: calc(100vh - 80px);
  overflow: hidden;
}
.overlay-panel.visible { display: flex; }
.upload-panel { width: 360px; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.panel-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}
.panel-close:hover { background: var(--surface2); }

.panel-all-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  padding: 2px 8px;
  transition: all 0.15s;
}
.panel-all-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--text); }

/* Overlay list */
#overlayList {
  overflow-y: auto;
  padding: 8px 0;
}
#overlayList::-webkit-scrollbar { width: 4px; }
#overlayList::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.overlay-group-heading {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 10px 16px 4px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}
.overlay-group-heading:first-child { border-top: none; }

.overlay-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.overlay-row:last-child { border-bottom: none; }

.overlay-row input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.overlay-row input[type=checkbox]:disabled { opacity: 0.35; cursor: not-allowed; }

.overlay-info { flex: 1; min-width: 0; }
.overlay-label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.overlay-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}
.type-pill {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 600;
  color: #fff;
}
.type-pill.wastewater { background: var(--blue); }
.type-pill.potable    { background: var(--green); }
.type-pill.ilp        { background: var(--purple); }
.type-pill.srlup      { background: #e67e22; }
.type-pill.zoning     { background: #8B0000; }
.type-pill.flood      { background: #1a5fa8; }
.type-pill.flood      { background: #2471a3; }
.type-pill.other      { background: var(--muted); }

.no-image-note {
  font-size: 10px;
  color: #e67e22;
  font-style: italic;
}

.overlay-opacity {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.overlay-opacity input[type=range] {
  width: 64px;
  accent-color: var(--accent);
}
.overlay-opacity span { font-size: 10px; color: var(--muted); }

/* ─── Upload panel body ───────────────────────── */
.upload-body {
  padding: 12px 16px 16px;
  overflow-y: auto;
  flex: 1;
}
.upload-body::-webkit-scrollbar { width: 4px; }
.upload-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.form-row {
  margin-bottom: 12px;
}
.form-row label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 4px;
}
.form-row input[type=text],
.form-row select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  background: var(--surface2);
  color: var(--text);
}
.form-row input:focus,
.form-row select:focus { outline: none; border-color: var(--accent); }
.form-row small { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }
.form-row input[type=file] { font-size: 12px; }

.bounds-preview {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--green);
  min-height: 14px;
  font-style: normal;
}
.bounds-preview.error { color: var(--red); }

.opacity-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.opacity-row input[type=range] {
  flex: 1;
  accent-color: var(--accent);
}
.opacity-row span { font-size: 12px; color: var(--muted); width: 36px; }

.upload-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.btn-primary {
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  font-weight: 500;
}
.btn-primary:hover { background: #b8760f; }
.btn-secondary {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
}
.btn-secondary:hover { background: #e0ddd7; }

.up-status {
  margin-top: 10px;
  font-size: 12px;
  color: var(--green);
  min-height: 16px;
}
.up-status.error { color: var(--red); }

/* Manage overlays list */
#manageList { padding: 4px 0; }
.manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.manage-row:last-child { border-bottom: none; }
.manage-row-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-delete {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 4px;
}
.btn-delete:hover { background: rgba(192,57,43,0.08); }

/* ─── Main layout ─────────────────────────────── */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#map { flex: 1; height: 100%; cursor: crosshair; }

/* ─── Sidebar ─────────────────────────────────── */
.sidebar {
  width: 340px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.sidebar-header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 17px;
  font-weight: 400;
  margin-bottom: 4px;
}
.sidebar-header p { font-size: 12px; color: var(--muted); }

.filters {
  display: none;
}
.filter-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}
.filter-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-active-count {
  display: none;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  padding: 1px 6px;
  font-weight: 600;
}

.filter-panel {
  display: none;
  flex-direction: column;
  border-bottom: 2px solid var(--border);
  background: var(--surface);
  max-height: 60vh;
  overflow-y: auto;
}
.filter-panel.open { display: flex; }
.filter-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.filter-panel-body { padding: 8px 20px 16px; }
.filter-group { margin-bottom: 14px; }
.filter-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 6px;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
}
.filter-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(196,132,26,0.08);
}
.filter-row {
  display: flex;
  gap: 10px;
}
.filter-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.filter-field select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
}
.filter-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 8px;
  cursor: pointer;
}
.filter-checkbox-row input { cursor: pointer; accent-color: var(--accent); }
.filter-apply-btn {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.15s;
}
.filter-apply-btn:hover { opacity: 0.88; }
.filter-clear-btn {
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  font-family: 'DM Sans', sans-serif;
}

.listings {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.listings::-webkit-scrollbar { width: 4px; }
.listings::-webkit-scrollbar-track { background: transparent; }
.listings::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.listing-card {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.listing-card:hover, .listing-card.active { background: var(--surface2); }
.listing-card.active {
  border-left: 2px solid var(--accent);
  padding-left: 18px;
}

.listing-thumb {
  width: calc(100% + 0px);
  height: 160px;
  margin: -14px -20px 12px -20px;
  overflow: hidden;
  border-radius: 0;
}
.listing-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.listing-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}
.listing-price {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  color: var(--accent);
  letter-spacing: -0.3px;
}
.listing-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.listing-address {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  line-height: 1.4;
}
.listing-suburb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.water-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 6px;
  font-weight: 500;
}
.water-badge.serviced   { background: rgba(39,174,96,0.12);  color: #27ae60; }
.water-badge.planned    { background: rgba(52,152,219,0.12); color: #2980b9; }
.water-badge.unserviced { background: rgba(192,57,43,0.12);  color: #c0392b; }
.water-badge.outside    { background: rgba(100,100,100,0.1); color: #666; }

/* ─── Leaflet popup ───────────────────────────── */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  font-family: 'DM Sans', sans-serif;
}
.popup-price {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  color: var(--accent);
  margin-bottom: 4px;
}
.popup-address { font-size: 12px; color: #333; margin-bottom: 8px; }
.popup-stats { display: flex; gap: 10px; font-size: 12px; color: #666; }

/* ─── Legend ──────────────────────────────────── */
.legend {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.legend-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  cursor: pointer;
  user-select: none;
}
.legend-toggle:hover { background: var(--surface2); }

.legend-toggle-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.legend-toggle-icon {
  font-size: 9px;
  color: var(--muted);
  transition: transform 0.2s;
}
.legend.collapsed .legend-toggle-icon { transform: rotate(180deg); }

.legend-body {
  padding: 0 20px 16px;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s;
  max-height: 600px;
  opacity: 1;
}
.legend.collapsed .legend-body {
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
}

.legend-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 7px;
}

.legend-item:last-child { margin-bottom: 0; }

.legend-swatch {
  display: inline-block;
  width: 28px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  opacity: 0.85;
}
/* ─── Basemap toggle ──────────────────────────────── */
.basemap-toggle {
  display: flex;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  border: 1px solid rgba(0,0,0,0.15);
}
.basemap-btn {
  padding: 6px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  background: var(--surface);
  color: var(--muted);
  transition: all 0.15s;
  border-right: 1px solid var(--border);
}
.basemap-btn:last-child { border-right: none; }
.basemap-btn:hover { background: var(--surface2); color: var(--text); }
.basemap-btn.active {
  background: var(--text);
  color: #fff;
}

/* ─── Kanban toggle button ────────────────────────────────────────────────── */
.kanban-toggle-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Kanban view ─────────────────────────────────────────────────────────── */
.kanban-view {
  display: none;
  position: fixed;
  inset: 56px 0 0 0;
  background: var(--bg);
  z-index: 1500;
  flex-direction: column;
  overflow: hidden;
}
.kanban-view.visible { display: flex; }

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.kanban-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  color: var(--text);
}
.kanban-title-icon {
  color: var(--accent);
  font-size: 20px;
}

.kanban-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.kanban-count {
  font-size: 12px;
  color: var(--muted);
}

/* ─── Board ───────────────────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 0;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 20px 20px 0;
}
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ─── Columns ─────────────────────────────────────────────────────────────── */
.kb-col {
  display: flex;
  flex-direction: column;
  width: 260px;
  min-width: 260px;
  margin-right: 12px;
  background: var(--surface2);
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  flex-shrink: 0;
}

.kb-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.kb-stage-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.kb-stage-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  flex: 1;
}
.kb-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 8px;
  font-weight: 600;
}

/* ─── Cards container ─────────────────────────────────────────────────────── */
.kb-cards {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
  transition: background 0.15s;
}
.kb-cards::-webkit-scrollbar { width: 3px; }
.kb-cards::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
.kb-cards.drag-over { background: rgba(196,132,26,0.07); }

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.kb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
  position: relative;
}
.kb-card:hover {
  box-shadow: 0 3px 12px rgba(0,0,0,0.1);
  border-color: rgba(0,0,0,0.15);
}
.kb-card.dragging {
  opacity: 0.5;
  transform: rotate(1.5deg);
  cursor: grabbing;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.kb-card.flash {
  animation: kb-flash 0.4s ease 2;
}
@keyframes kb-flash {
  0%, 100% { border-color: var(--border); }
  50%       { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(196,132,26,0.2); }
}

.kb-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.kb-card-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  background: var(--surface2);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.kb-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 3px;
  line-height: 1;
  transition: all 0.12s;
}
.kb-remove:hover { color: var(--red); background: rgba(192,57,43,0.08); }

.kb-card-price {
  font-family: 'DM Serif Display', serif;
  font-size: 17px;
  color: var(--accent);
  letter-spacing: -0.2px;
  margin-bottom: 3px;
}
.kb-card-address {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 2px;
}
.kb-card-suburb {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}
.kb-card-stats {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}

.kb-stage-select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface2);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 8px;
  cursor: pointer;
}
.kb-stage-select:focus { outline: none; border-color: var(--accent); }

.kb-note {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface2);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: var(--text);
  resize: none;
  line-height: 1.5;
  box-sizing: border-box;
}
.kb-note:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.kb-note::placeholder { color: #bbb; }

/* ─── Timestamped notes ──────────────────────────────────────────────────── */
.kb-notes-section { margin-top: 4px; }

.kb-notes-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.kb-notes-input-row .kb-note-input {
  flex: 1;
  width: auto;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface2);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: var(--text);
  resize: none;
  line-height: 1.5;
  box-sizing: border-box;
}
.kb-notes-input-row .kb-note-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.kb-notes-input-row .kb-note-input::placeholder { color: #bbb; }

.kb-note-add-btn {
  padding: 5px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.kb-note-add-btn:hover { background: #155c30; }

.kb-notes-empty {
  font-size: 11px;
  color: #bbb;
  padding: 2px 0 6px;
}

.kb-note-entry {
  border-left: 2px solid var(--border);
  padding: 4px 0 4px 10px;
  margin-bottom: 8px;
}
.kb-note-entry:last-child { margin-bottom: 0; }

.kb-note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}

.kb-note-date {
  font-size: 10px;
  color: #aaa;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.kb-note-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 10px;
  color: #ccc;
  padding: 0 2px;
  line-height: 1;
}
.kb-note-delete:hover { color: #c0392b; }

.kb-note-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─── Pipeline add button on listing cards ────────────────────────────────── */
.pipeline-add-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-weight: 300;
}
.pipeline-add-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pipeline-add-btn.in-pipeline {
  background: rgba(39,174,96,0.1);
  border-color: #27ae60;
  color: #27ae60;
  font-size: 11px;
}

/* ─── Kanban toast ────────────────────────────────────────────────────────── */
#kanbanToast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 9999;
  transition: transform 0.3s;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
#kanbanToast.show { transform: translateX(-50%) translateY(0); }

/* ─── Search result card in sidebar ──────────────────────────────────────── */
.search-result-card {
  padding: 14px 20px 16px;
  border-bottom: 2px solid var(--accent);
  background: linear-gradient(135deg, rgba(196,132,26,0.04) 0%, var(--surface) 60%);
  position: relative;
}

.src-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(196,132,26,0.4);
  border-radius: 4px;
  padding: 1px 7px;
  margin-bottom: 8px;
}

.src-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  margin-bottom: 2px;
}

.src-type {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.src-agent {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}

.src-address {
  font-family: 'DM Serif Display', serif;
  font-size: 15px;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 3px;
}

.src-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.src-lotdp {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 12px;
  font-style: italic;
}

.src-links-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 8px;
}

.src-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.src-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
  border: 1px solid var(--border);
}

.src-link-domain {
  background: #fff;
  color: #222;
}
.src-link-domain:hover {
  background: #1565c0;
  color: #fff;
  border-color: #1565c0;
}

.src-link-rea {
  background: #fff;
  color: #222;
}
.src-link-rea:hover {
  background: #e11;
  color: #fff;
  border-color: #e11;
}

.src-link-tag {
  font-size: 10px;
  opacity: 0.65;
  font-weight: 400;
}

.src-disclaimer {
  font-size: 10px;
  color: #bbb;
  line-height: 1.4;
  margin-bottom: 10px;
}

.src-pipeline-btn {
  width: 100%;
  padding: 7px 12px;
  border-radius: 5px;
  border: 1px dashed var(--accent);
  background: rgba(196,132,26,0.05);
  color: var(--accent);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.src-pipeline-btn:hover {
  background: var(--accent);
  color: #fff;
  border-style: solid;
}

/* ─── Domain API enrichment styles ───────────────────────────────────────── */
.domain-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(30,167,101,0.1);
  color: #1ea765;
  border: 1px solid rgba(30,167,101,0.25);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.domain-badge:hover {
  background: rgba(30,167,101,0.18);
}
.domain-badge.mock {
  background: rgba(100,100,100,0.07);
  color: var(--muted);
  border-color: var(--border);
}
.dom-days {
  color: #1ea765;
  font-weight: 400;
  border-left: 1px solid rgba(30,167,101,0.35);
  padding-left: 5px;
  margin-left: 2px;
}
.domain-badge.mock .dom-days { color: var(--muted); border-color: var(--border); }

.listing-agent {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
}
.agent-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}
.agent-agency {
  margin-left: auto;
  font-size: 10px;
  text-align: right;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Kanban Vendor Terms ─────────────────────────────────────────────────── */
.kb-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 10px 0 6px;
}

.kb-terms {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
}

.kb-terms-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 2px;
}

.kb-field-wrap { display: flex; flex-direction: column; gap: 3px; }

.kb-field-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.kb-input {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.12s;
}
.kb-input:focus { outline: none; border-color: var(--accent); }
.kb-input::placeholder { color: #bbb; }

/* Deposit rows */
.kb-deposit-row {
  position: relative;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}
.kb-deposit-row:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.kb-deposit-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 4px;
}

.kb-dep-remove {
  position: absolute;
  top: 8px;
  right: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1;
}
.kb-dep-remove:hover { color: var(--red); background: rgba(192,57,43,0.08); }

.kb-add-deposit {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 5px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
}
.kb-add-deposit:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(196,132,26,0.04);
}

/* ─── Terms Offered / Offer History ──────────────────────────────────────── */
.kb-offer-form {
  background: rgba(41,128,185,0.04);
  border: 1px solid rgba(41,128,185,0.2);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
}

.kb-submit-offer {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 6px;
  border: none;
  border-radius: 5px;
  background: #2980b9;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  text-align: center;
}
.kb-submit-offer:hover { background: #1f6799; }

.kb-offers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}

.kb-offers-empty {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  padding: 4px 0;
}

.kb-offer-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid #2980b9;
  border-radius: 5px;
  padding: 8px 10px;
}

.kb-offer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.kb-offer-date {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}

.kb-offer-delete {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1;
}
.kb-offer-delete:hover { color: var(--red); background: rgba(192,57,43,0.08); }

.kb-offer-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kb-offer-field {
  font-size: 11px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}

.kb-offer-lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-right: 4px;
}

.kb-offer-deposits {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.kb-offer-dep {
  font-size: 10px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
}

.kb-offer-deps-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 5px;
  margin-bottom: 3px;
}

.kb-offer-deposits-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.kb-card-address-link {
  cursor: pointer;
  color: var(--accent);
  transition: opacity 0.12s;
}
.kb-card-address-link:hover { opacity: 0.75; text-decoration: underline; }

/* ─── Due Diligence section ───────────────────────────────────────────────── */
.kb-dd {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

/* Two-column layout inside the modal */
.kb-modal .kb-dd {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.kb-modal .kb-dd-row:nth-child(odd)  { border-right: 1px solid var(--border); }
.kb-modal .kb-dd-row:last-child      { border-bottom: none; }
.kb-modal .kb-dd-row:nth-last-child(-n+2) { border-bottom: none; }

.kb-dd-row {
  display: grid;
  grid-template-columns: 1fr 90px;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.kb-dd-row .kb-dd-label    { grid-column: 1; grid-row: 1; }
.kb-dd-row .kb-dd-select   { grid-column: 2; grid-row: 1; }
.kb-dd-row .kb-dd-note     { grid-column: 1 / -1; grid-row: 2; font-size: 10px; padding: 3px 6px; }
.kb-dd-row:last-child { border-bottom: none; }
.kb-dd-row:nth-child(even) { background: var(--surface2); }

.kb-dd-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.kb-dd-select {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
  width: 90px;
}
.kb-dd-select:focus { outline: none; border-color: var(--accent); }

.kb-dd-select.dd-risk-low      { background: #eafaf1; border-color: #27ae60; color: #1e8449; }
.kb-dd-select.dd-risk-possible { background: #fef9e7; border-color: #f39c12; color: #b7770d; }
.kb-dd-select.dd-risk-high     { background: #fdedec; border-color: #e74c3c; color: #c0392b; }
.kb-dd-select.dd-risk-none     { background: var(--surface); color: var(--muted); }

.kb-dd-note {
  font-size: 10px;
  padding: 3px 6px;
  min-width: 0;
}

/* ─── Kanban summary card indicators ─────────────────────────────────────── */
.kb-card-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.kb-ind {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface2);
}
.kb-ind-terms  { border-color: #c4841a; color: #c4841a; background: rgba(196,132,26,0.07); }
.kb-ind-offers { border-color: #2980b9; color: #2980b9; background: rgba(41,128,185,0.07); }
.kb-ind-dd              { border-color: #8e44ad; color: #8e44ad; background: rgba(142,68,173,0.07); }
.kb-ind-dd.dd-low       { border-color: #27ae60; color: #27ae60; background: rgba(39,174,96,0.1); }
.kb-ind-dd.dd-possible  { border-color: #e67e22; color: #e67e22; background: rgba(230,126,34,0.1); }
.kb-ind-dd.dd-high      { border-color: #e74c3c; color: #e74c3c; background: rgba(231,76,60,0.1); }
.kb-ind-note   { border-color: #27ae60; color: #27ae60; background: rgba(39,174,96,0.07);  }

/* ─── Card detail modal ───────────────────────────────────────────────────── */
.kb-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}

.kb-modal {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kb-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.kb-modal-price {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--accent);
  margin-bottom: 3px;
}
.kb-modal-address {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.kb-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  padding: 4px 6px;
  border-radius: 5px;
  line-height: 1;
  margin-left: 12px;
  flex-shrink: 0;
}
.kb-modal-close:hover { background: var(--surface2); color: var(--text); }

.kb-offer-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.kb-submit-offer {
  flex: 1;
}
.kb-finance-btn {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface2));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  color: var(--accent);
  padding: 6px 12px;
  line-height: 1.4;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.kb-finance-btn:hover {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface2));
  border-color: var(--accent);
}

.kb-modal-body {
  overflow-y: auto;
  padding: 20px;
  flex: 1;
}
.kb-modal-body::-webkit-scrollbar { width: 4px; }
.kb-modal-body::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* ─── Electricity legend ──────────────────────────────────────────────────── */
.elec-legend-item {
  align-items: center;
}
.legend-line {
  display: inline-block;
  width: 28px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}
.elec-kv {
  font-weight: 600;
  font-size: 12px;
  min-width: 52px;
}
.elec-ease {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}

/* ─── Multi-select ────────────────────────────────────────────────────────── */
.listing-card.multi-selected {
  background: rgba(26, 107, 58, 0.06);
  border-left: 2px solid #1a6b3a;
  padding-left: 18px;
}

.multi-select-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 2px solid #1a6b3a;
  padding: 14px 20px 18px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  z-index: 10;
}

.msb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.msb-count {
  font-size: 12px;
  font-weight: 600;
  color: #1a6b3a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.msb-clear {
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
}
.msb-clear:hover { color: var(--text); }

.msb-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 6px;
}

.msb-input {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 10px;
  box-sizing: border-box;
}
.msb-input:focus {
  outline: none;
  border-color: #1a6b3a;
}

.msb-add {
  width: 100%;
  background: #1a6b3a;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.msb-add:hover { background: #155830; }

/* ─── Measurement Tool ───────────────────────────────────────────────────────── */
.measure-tooltip {
  background: rgba(0,0,0,0.75);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.measure-tooltip::before { display: none; }

.measure-seg-label {
  font-size: 11px !important;
  padding: 2px 7px !important;
  opacity: 0.85;
}

/* ─── Domain API error state ─────────────────────────────────────────────── */
.domain-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  gap: 10px;
}
.domain-error-icon {
  font-size: 32px;
  color: var(--muted);
}
.domain-error-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.domain-error-msg {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 220px;
}
.domain-error-retry {
  margin-top: 8px;
  padding: 7px 20px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}
.domain-error-retry:hover { background: var(--border); }

/* ─── Note contact tagging ───────────────────────────────────────────────────── */
.kb-note-contact-row {
  position: relative;
  margin-bottom: 6px;
}
.kb-note-contact-search {
  width: 100%;
  font-size: 12px;
}
.kb-note-contact-results {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  max-height: 140px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.kb-note-contact-result {
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f4f4f4;
}
.kb-note-contact-result:last-child { border-bottom: none; }
.kb-note-contact-result:hover { background: #f0f7f3; }
.kb-note-contact-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #e8f5ee;
  border-radius: 4px;
  font-size: 12px;
  color: #1a6b3a;
  font-weight: 600;
}
.kb-note-contact-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: #1a6b3a;
  font-size: 11px;
  padding: 0 2px;
  line-height: 1;
}
.kb-note-contact-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  background: #e8f5ee;
  color: #1a6b3a;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}

/* ── Finance picker (in kanban modal) ───────────────────────────────────────── */
.kb-finance-picker {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.kb-fin-pick-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.kb-fin-pick-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.kb-fin-pick-row:last-child { border-bottom: none; }
.kb-fin-pick-main { flex: 1; min-width: 0; }
.kb-fin-pick-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.kb-fin-pick-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.kb-fin-pick-date {
  font-size: 10px;
  color: var(--muted);
  margin-left: auto;
}
.kb-fin-pick-latest {
  font-size: 9px;
  font-weight: 600;
  background: var(--green);
  color: #fff;
  border-radius: 3px;
  padding: 1px 4px;
  vertical-align: middle;
  margin-left: 4px;
}
.kb-fin-pick-detail {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}
.kb-fin-pick-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.kb-fin-pick-meta {
  font-size: 11px;
  color: var(--muted);
}
.kb-fin-pick-deps {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.5;
}
.kb-fin-pick-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.kb-fin-pick-btn {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface2));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  color: var(--accent);
  padding: 4px 10px;
  white-space: nowrap;
  transition: background 0.12s;
}
.kb-fin-pick-btn:hover {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface2));
}
.kb-fin-pick-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--muted);
  padding: 2px 4px;
  border-radius: 3px;
  transition: color 0.12s, background 0.12s;
}
.kb-fin-pick-delete:hover {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 10%, var(--surface2));
}

.kb-dep-note-inline {
  flex: 0 1 120px;
  font-size: 11px;
}

/* ── Add Offer button in picker header ───────────────────────────────────────── */
.kb-fin-pick-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kb-add-offer-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: opacity 0.12s;
  flex-shrink: 0;
}
.kb-add-offer-btn:hover { opacity: 0.85; }

/* ── Offer popup (inside finance picker) ─────────────────────────────────────── */
.kb-offer-popup {
  border-top: 1px solid var(--border);
  background: var(--surface2);
}
.kb-offer-popup-inner {
  padding: 12px;
}
.kb-offer-popup-cancel {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 12px;
  cursor: pointer;
}
.kb-offer-popup-cancel:hover { color: var(--text); border-color: var(--text); }
