:root {
  --ink: #17211d;
  --muted: #64706a;
  --paper: #f6f4ed;
  --surface: #fffef9;
  --line: #dce1db;
  --accent: #176b50;
  --accent-dark: #0c4b37;
  --accent-soft: #dff2e9;
  --warn: #7f351d;
  --shadow: 0 12px 30px rgb(23 33 29 / 8%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  max-width: 1180px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px clamp(16px, 4vw, 48px) 72px;
  background:
    radial-gradient(circle at top right, rgb(23 107 80 / 10%), transparent 28rem),
    var(--paper);
}

body.leads-active {
  max-width: 1800px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent-dark);
  text-underline-offset: 0.18em;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

:focus-visible {
  outline: 3px solid #e6a927;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.site-header,
.section-heading,
.card-top,
.actions,
.usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-header {
  align-items: flex-end;
  margin-bottom: 28px;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -0.025em;
}

h3 {
  margin-bottom: 6px;
  font-size: 1.08rem;
}

h4 {
  margin-bottom: 5px;
  font-size: 0.92rem;
  line-height: 1.25;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.usage {
  min-width: 245px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgb(255 254 249 / 80%);
  font-size: 0.8rem;
}

.usage-row + .usage-row {
  margin-top: 4px;
}

.usage strong {
  color: var(--ink);
}

.view-nav {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 28px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 254 249 / 75%);
}

.nav-button {
  min-width: 110px;
  padding: 9px 16px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.nav-button.is-active {
  color: white;
  background: var(--ink);
}

.view {
  animation: appear 180ms ease-out;
}

@keyframes appear {
  from { opacity: 0; transform: translateY(4px); }
}

.section-heading {
  align-items: flex-end;
  margin-bottom: 22px;
}

.section-heading > p {
  max-width: 460px;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toolbar.compact {
  box-shadow: none;
}

.lead-filter-group {
  flex: 1 1 260px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.lead-filter-group legend {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.lead-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
}

.lead-filter-options .check-control {
  min-height: 32px;
}

.lead-sort-field {
  flex: 0 1 220px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.grow {
  flex: 1 1 300px;
}

.coordinate-field {
  flex: 1 1 130px;
}

.radius-field {
  flex: 0 0 125px;
}

.map-picker {
  flex: 1 0 100%;
  min-width: 0;
}

.map-instructions {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.location-map {
  z-index: 0;
  width: 100%;
  height: clamp(270px, 32vw, 340px);
  border: 1px solid #bbc4bd;
  border-radius: 12px;
  background: #e8ece8;
}

.location-marker {
  width: 28px;
  height: 38px;
  border: 0;
  background: transparent;
}

.location-marker .map-pin-shape {
  display: block;
  width: 28px;
  height: 28px;
  border: 3px solid white;
  border-radius: 50% 50% 50% 0;
  background: var(--accent);
  box-shadow: 0 3px 8px rgb(0 0 0 / 30%);
  transform: rotate(-45deg);
}

.location-marker .map-pin-shape::after {
  display: block;
  width: 8px;
  height: 8px;
  margin: 7px;
  border-radius: 50%;
  background: white;
  content: "";
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bbc4bd;
  border-radius: 9px;
  color: var(--ink);
  background: white;
}

input,
select {
  min-height: 42px;
  padding: 9px 11px;
}

textarea {
  min-height: 92px;
  padding: 10px 11px;
  line-height: 1.45;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

.primary,
.secondary,
.danger,
.text-button {
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 9px;
  font-weight: 750;
}

.primary {
  border: 1px solid var(--accent);
  color: white;
  background: var(--accent);
}

.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.secondary {
  border: 1px solid #aeb9b2;
  color: var(--ink);
  background: white;
}

.secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.danger {
  border: 1px solid #e2b8ab;
  color: var(--warn);
  background: #fff8f5;
}

.text-button {
  min-height: auto;
  padding: 5px 2px;
  border: 0;
  color: var(--accent-dark);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.status-line {
  min-height: 1.4em;
  margin: 8px 2px 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 14px;
}

.kanban-board {
  display: grid;
  grid-auto-columns: minmax(220px, 1fr);
  grid-auto-flow: column;
  align-items: start;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.kanban-column {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(220 225 219 / 35%);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 3px 9px;
}

.kanban-column-header h3 {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kanban-count {
  min-width: 22px;
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
}

.kanban-cards {
  display: grid;
  align-content: start;
  gap: 8px;
}

.kanban-empty {
  margin: 8px 4px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.place-card,
.lead-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.place-card {
  display: flex;
  flex-direction: column;
  min-height: 270px;
  padding: 18px;
}

.lead-card {
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgb(23 33 29 / 6%);
}

.lead-card[data-priority="high"] {
  border-left: 3px solid #b44b2f;
}

.lead-card[data-priority="low"] {
  border-left: 3px solid #aeb9b2;
}

.card-top {
  align-items: flex-start;
}

.card-top > div {
  min-width: 0;
}

.badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.address,
.meta,
.contact,
.attribution,
.call-reason {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.address {
  margin-bottom: 10px;
}

.meta {
  margin-bottom: 12px;
}

.contact {
  display: grid;
  gap: 5px;
  margin-bottom: 14px;
}

.lead-card h4 {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  line-height: 1.2;
}

.lead-card .address {
  display: -webkit-box;
  margin-bottom: 5px;
  overflow: hidden;
  font-size: 0.72rem;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.lead-card .meta {
  margin-bottom: 6px;
  overflow: hidden;
  font-size: 0.66rem;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

.lead-contact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 8px;
  margin-bottom: 8px;
  font-size: 0.72rem;
}

.lead-phone {
  flex-basis: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.lead-contact .text-button {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 0;
  font-size: 0.72rem;
}

.attribution {
  margin-top: auto;
  margin-bottom: 12px;
  padding-top: 8px;
  font-size: 0.75rem;
}

.actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
}

.actions > button,
.actions > a {
  flex: 0 1 auto;
}

.lead-quick-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  margin-bottom: 7px;
}

.next-contact-field {
  grid-column: 1 / -1;
}

.lead-card label {
  gap: 3px;
  font-size: 0.66rem;
}

.lead-card input,
.lead-card select {
  min-height: 32px;
  padding: 4px 6px;
  border-radius: 7px;
  font-size: 0.72rem;
}

.call-panel {
  padding: 7px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.call-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.check-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  color: var(--ink);
  font-size: 0.7rem;
}

.check-control input {
  width: 14px;
  height: 14px;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.lead-card .primary,
.lead-card .secondary,
.lead-card .danger {
  min-height: 32px;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 0.72rem;
}

.call-reason {
  margin: 5px 0 0;
  font-size: 0.66rem;
  line-height: 1.3;
}

.note-preview {
  display: -webkit-box;
  margin: 7px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.lead-more {
  margin-top: 7px;
}

.lead-more summary {
  display: flex;
  align-items: center;
  min-height: 24px;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 750;
}

.lead-more[open] summary {
  margin-bottom: 7px;
}

.lead-more textarea {
  min-height: 64px;
  padding: 6px;
  border-radius: 7px;
  font-size: 0.72rem;
}

.lead-more .actions {
  gap: 5px;
  margin-top: 6px;
}

.lead-card > .attribution {
  margin: 7px 0 0;
  padding-top: 5px;
  font-size: 0.63rem;
}

.legal-note {
  margin: 0 2px 16px;
  padding: 11px 13px;
  border-left: 3px solid #d6a72a;
  color: #5b5541;
  background: #fff9e7;
  font-size: 0.86rem;
  line-height: 1.45;
}

.center {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.empty-state {
  padding: 34px 24px;
  color: var(--muted);
  text-align: center;
}

.notice {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 16px;
  border-radius: 10px;
  color: white;
  background: #762f20;
  box-shadow: 0 12px 34px rgb(0 0 0 / 22%);
  font-size: 0.9rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  body {
    padding-top: 22px;
  }

  .site-header,
  .section-heading,
  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .site-header,
  .section-heading {
    align-items: start;
  }

  .usage {
    width: 100%;
  }

  .toolbar > button {
    width: 100%;
  }

  .radius-field {
    width: 100%;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
  }
}
