:root {
  --primary: #b35d33;
  --primary-hover: #9a4f2a;
  --bg: #f7f3ee;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --tag-bg: #e8f4fd;
  --tag-text: #5ba4cf;
  --icon-bg: #fde8d8;
  --open: #1d8a4a;
  --closed: #c53030;
  --star: #e5984e;
  --radius: 12px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(26, 26, 26, 0.06);
  --shadow-hover: 0 4px 20px rgba(26, 26, 26, 0.1);
  --border: rgba(26, 26, 26, 0.08);
  --font: "Poppins", system-ui, -apple-system, sans-serif;
  --font-heading: "Fredoka", system-ui, sans-serif;
  --selected-pin: #2a9d58;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

/* —— Top bar —— */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  opacity: 0.92;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: #e8d5c4;
  color: #6b4423;
}

.brand-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  color: #5c3d27;
  line-height: 1.2;
}

.search-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.6rem;
  flex: 1 1 280px;
  min-width: 0;
}

.search-bar input[type="search"],
.search-bar input[type="number"] {
  font: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  padding: 0.65rem 0.9rem;
}

.search-bar input[type="search"] {
  flex: 1 1 180px;
  min-width: 0;
}

.search-bar input[type="number"] {
  width: 4.5rem;
  text-align: center;
  flex-shrink: 0;
}

.search-bar .industry-select {
  font: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  min-width: 10.25rem;
  max-width: 100%;
  flex-shrink: 0;
  cursor: pointer;
}

.search-bar .industry-select:focus {
  outline: 2px solid rgba(179, 93, 51, 0.35);
  outline-offset: 2px;
  border-color: rgba(179, 93, 51, 0.45);
}

.search-bar input:focus {
  outline: 2px solid rgba(179, 93, 51, 0.35);
  outline-offset: 2px;
  border-color: rgba(179, 93, 51, 0.45);
}

.search-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(179, 93, 51, 0.35);
  transition: background 0.15s ease, transform 0.1s ease;
}

.search-submit:hover {
  background: var(--primary-hover);
}

.search-submit:active {
  transform: scale(0.98);
}

.search-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.search-icon {
  display: flex;
  color: #b8e0ff;
}

.status {
  margin: 0;
  flex: 1 1 200px;
  font-size: 0.8125rem;
  color: var(--muted);
  min-width: 0;
}

.status.is-error {
  color: var(--closed);
}

.status.is-ok {
  color: var(--open);
}

/* —— Split shell —— */
.shell {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  min-height: 0;
  height: calc(100vh - 88px);
  height: calc(100dvh - 88px);
  overflow: hidden;
}

@media (max-width: 840px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(240px, 38vh) 1fr;
    height: calc(100vh - 76px);
    height: calc(100dvh - 76px);
    min-height: 0;
    overflow: hidden;
  }
}

.sidebar {
  overflow-y: auto;
  padding: 0.75rem 1rem 1rem;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sidebar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.result-count {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.view-toggle {
  display: flex;
  gap: 0.25rem;
  background: var(--card);
  padding: 0.2rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.view-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.view-icon-btn:hover {
  color: var(--text);
  background: var(--bg);
}

.view-icon-btn.is-active {
  background: var(--primary);
  color: #fff;
}

.filter-chips {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.filter-chip:hover {
  color: var(--text);
  border-color: rgba(179, 93, 51, 0.35);
}

.filter-chip.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.filter-chip-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.filter-chip-icon--metal {
  filter: hue-rotate(200deg);
}

@media (max-width: 840px) {
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 42vh;
    scrollbar-gutter: stable;
  }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(179, 93, 51, 0.08);
  text-decoration: none;
}

.nav-link.is-active {
  color: var(--primary);
  background: rgba(179, 93, 51, 0.12);
}

.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
}

.results-list.is-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

@media (min-width: 360px) {
  .results-list.is-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.results-list.is-grid .result-wrap {
  flex-direction: column;
}

.results-list.is-grid .result-wrap-actions {
  flex-direction: row;
  justify-content: flex-start;
  flex-wrap: wrap;
  padding: 0 0 0.35rem 0.35rem;
}

.result-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.result-wrap-main {
  flex: 1;
  min-width: 0;
}

.result-wrap-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  flex-shrink: 0;
  padding: 0.25rem 0;
}

.btn-lead {
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  border: 2px solid var(--primary);
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(179, 93, 51, 0.12);
  transition: background 0.12s ease, color 0.12s ease, transform 0.1s ease;
}

.btn-lead:hover {
  background: var(--primary);
  color: #fff;
}

.btn-lead:active {
  transform: scale(0.97);
}

.result-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.result-card:hover {
  box-shadow: var(--shadow-hover);
}

.result-card.is-selected {
  border-color: rgba(42, 157, 88, 0.55);
  box-shadow: var(--shadow-hover), 0 0 0 2px rgba(42, 157, 88, 0.2);
}

.result-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--icon-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.result-card-icon svg {
  width: 22px;
  height: 22px;
}

.result-card-body {
  min-width: 0;
  flex: 1;
}

.result-card-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
}

.result-card-address {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
}

.result-card-address svg {
  flex-shrink: 0;
  margin-top: 0.1rem;
  opacity: 0.65;
}

.result-card-rating {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
}

.stars {
  letter-spacing: -0.06em;
  font-size: 0.85rem;
}

.stars-fill {
  color: var(--star);
}

.rating-num {
  font-weight: 600;
  color: var(--text);
}

.review-count {
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-size: 0.75rem;
}

.stars-dim {
  color: #ddd5cb;
  letter-spacing: -0.06em;
}

.result-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
}

.status-pill {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-pill.is-open {
  color: var(--open);
}

.status-pill.is-closed {
  color: var(--closed);
}

.status-pill.is-unknown {
  color: var(--muted);
}

.type-pill {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
}

.map-pane {
  position: relative;
  min-height: 280px;
  background: #ebe4dc;
}

.map-legend {
  position: absolute;
  z-index: 500;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  box-shadow: var(--shadow);
  pointer-events: none;
}

.map-legend-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

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

.map-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.map-legend-dot--primary {
  background: var(--primary);
}

.map-legend-dot--selected {
  background: var(--selected-pin);
}

.map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Leaflet numbered markers */
.mfg-marker-wrap {
  background: none !important;
  border: none !important;
}

.marker-pin {
  width: 32px;
  height: 40px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 42'%3E%3Cpath fill='%23B35D33' d='M16 0C8.5 0 3 5.2 3 11.8c0 8.5 13 22.2 13 22.2s13-13.7 13-22.2C29 5.2 23.5 0 16 0z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.marker-pin.is-selected-pin {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 42'%3E%3Cpath fill='%232a9d58' d='M16 0C8.5 0 3 5.2 3 11.8c0 8.5 13 22.2 13 22.2s13-13.7 13-22.2C29 5.2 23.5 0 16 0z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  filter: drop-shadow(0 3px 8px rgba(42, 157, 88, 0.45));
  transform: scale(1.08);
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius-sm);
  font-family: var(--font);
}

.leaflet-popup-content {
  margin: 0.65rem 0.85rem;
  font-size: 0.875rem;
}

.popup-title {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.popup-links {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Do not apply CSS filter on .leaflet-tile-pane — it breaks pan/drag hit-testing in several browsers. */

.map-selected-hud {
  position: absolute;
  z-index: 650;
  left: 14px;
  bottom: 14px;
  max-width: min(300px, calc(100% - 28px));
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
  font-size: 0.8125rem;
  pointer-events: auto;
}

.map-selected-hud[hidden] {
  display: none !important;
}

.map-selected-hud .hud-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: #5c3d27;
  line-height: 1.25;
}

.map-selected-hud .hud-line {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.map-selected-hud .hud-links {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.map-selected-hud .hud-hint {
  margin: 0.5rem 0 0;
  font-size: 0.7rem;
  color: var(--muted);
}

.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 36rem;
  margin: 0 auto;
}

.empty-state[hidden] {
  display: none;
}

/* —— Detail drawer —— */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
}

.drawer:not([hidden]) {
  pointer-events: auto;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.35);
  backdrop-filter: blur(2px);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(100%, 400px);
  height: 100%;
  background: var(--card);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  animation: drawer-in 0.22s ease-out;
}

@keyframes drawer-in {
  from {
    transform: translateX(100%);
    opacity: 0.9;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.drawer-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
  color: #5c3d27;
  line-height: 1.2;
}

.drawer-close {
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
}

.drawer-close:hover {
  background: var(--bg);
  color: var(--text);
}

.drawer-body {
  padding: 1rem 1.1rem;
  overflow-y: auto;
  flex: 1;
  font-size: 0.9rem;
}

.drawer-body dl {
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.drawer-body dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

.drawer-body dd {
  margin: 0.15rem 0 0;
}

.drawer-foot {
  margin: 0;
  padding: 0 1.1rem 0.5rem;
  font-size: 0.8rem;
}

.drawer-actions {
  padding: 0.75rem 1.1rem 1.1rem;
  border-top: 1px solid var(--border);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: rgba(179, 93, 51, 0.35);
  background: #fff;
  text-decoration: none;
}

/* —— Leads page —— */
.leads-toolbar {
  margin-left: auto;
}

.leads-main {
  flex: 1;
  padding: 1rem 1.25rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.leads-status {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.leads-table-wrap {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.leads-table th,
.leads-table td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.leads-table th {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--bg);
}

.leads-table tbody tr:last-child td {
  border-bottom: none;
}

.leads-table tbody tr:hover td {
  background: rgba(179, 93, 51, 0.04);
}

/* —— Pagination (Search) —— */
.pager {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pager-hint {
  font-size: 0.8rem;
}

/* —— Auth nav —— */
.nav-auth {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-left: 0.25rem;
}

.nav-user {
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.nav-link-like {
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}

button.nav-link-like:hover {
  color: var(--primary-hover);
}

/* —— Login —— */
.login-page .login-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 1.75rem 1.5rem;
}

.login-title {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  margin: 0 0 0.35rem;
}

.login-sub {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.login-label input {
  font: inherit;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.login-error {
  color: var(--closed);
  font-size: 0.9rem;
  margin: 0;
}

.login-submit {
  margin-top: 0.25rem;
}

.login-hint {
  margin: 1.25rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
}

.login-hint code {
  font-size: 0.78em;
  background: var(--bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* —— Admin —— */
.admin-main {
  flex: 1;
  padding: 1rem 1.25rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.admin-section {
  padding: 1.25rem;
}

.admin-h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin: 0 0 1rem;
}

.admin-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.admin-form-row label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.admin-form-row input,
.admin-form-row select {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-width: 10rem;
}

.admin-users-table .admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.admin-users-table .admin-newpass {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  max-width: 11rem;
}

.admin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.leads-email-cell {
  min-width: 14rem;
}

.leads-email-cell .email-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.leads-email-cell input[type="email"] {
  font: inherit;
  flex: 1;
  min-width: 8rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.leads-table-wide {
  overflow-x: auto;
}

.leads-comments-cell textarea.lead-comments-input {
  font: inherit;
  width: 100%;
  min-width: 10rem;
  max-width: 18rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  resize: vertical;
}

.leads-status-cell select.lead-status-input {
  font: inherit;
  max-width: 10rem;
  padding: 0.35rem 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.leads-save-cell {
  white-space: nowrap;
}

.manual-lead-section {
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.manual-lead-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
}

.manual-lead-hint {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.manual-lead-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.85rem 1rem;
  align-items: end;
}

.manual-lead-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.manual-lead-form input,
.manual-lead-form select,
.manual-lead-form textarea {
  font: inherit;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.manual-lead-comments-label {
  grid-column: 1 / -1;
}

.manual-lead-form .req {
  color: var(--closed);
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.admin-tab {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  color: var(--text);
}

.admin-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.admin-tab.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  margin: 0 0 0.65rem;
}

.api-summary-line {
  margin: 0 0 0.5rem;
}

.api-top-user {
  margin: 0;
  font-weight: 600;
  color: var(--primary);
}

.login-ua-cell {
  max-width: 14rem;
  font-size: 0.75rem;
  word-break: break-word;
}

#detail-drawer .drawer-foot a {
  color: var(--primary);
}
