:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-soft: #eef2ec;
  --ink: #17201a;
  --muted: #607064;
  --line: #d8dfd5;
  --green: #187b4d;
  --orange: #c57b16;
  --blue: #285b86;
  --shadow: 0 18px 48px rgba(29, 42, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(rgba(16, 29, 20, 0.82), rgba(16, 29, 20, 0.82)),
    url("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/7/48/34");
  background-size: cover;
}

.login-panel {
  width: min(100%, 430px);
  display: grid;
  gap: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-panel .brand-mark {
  color: #fff;
}

.login-panel h1 {
  font-size: 29px;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.login-panel form,
.login-panel label {
  display: grid;
  gap: 8px;
}

.login-panel form {
  gap: 14px;
}

.login-panel label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.login-panel input {
  border-color: var(--line);
  background: #f8faf7;
  color: var(--ink);
}

.login-panel button {
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  padding: 12px 14px;
}

.login-error {
  background: #fff2f0;
  border: 1px solid #f0b8aa;
  color: #8b2c1f !important;
  padding: 10px 12px;
}

.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #162019;
  color: #f8fbf5;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #244331;
  font-weight: 800;
}

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

h1 {
  font-size: 22px;
  line-height: 1.1;
}

.brand-row p,
.toolbar p,
.source-note,
.meta,
.empty-state,
.detail-head p {
  color: var(--muted);
}

.sidebar .brand-row p,
.sidebar .source-note {
  color: rgba(248, 251, 245, 0.68);
}

.auth-panel,
.password-panel,
.admin-panel {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  padding: 13px;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-panel span,
.admin-head span,
.add-user-form span,
.password-form span,
.admin-user-card span {
  color: rgba(248, 251, 245, 0.68);
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-panel strong {
  display: block;
  font-size: 15px;
  margin-top: 3px;
}

.auth-panel button,
.add-user-form button,
.password-form button,
.admin-user-card button {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  padding: 8px 10px;
}

.password-panel,
.admin-panel {
  display: grid;
  gap: 12px;
}

.admin-panel[hidden] {
  display: none;
}

.admin-head,
.admin-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-head h2 {
  font-size: 16px;
}

.add-user-form,
.password-form {
  display: grid;
  gap: 10px;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
}

.add-user-form p,
.password-form p {
  color: rgba(248, 251, 245, 0.72);
  font-size: 12px;
  min-height: 16px;
}

.admin-users {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
}

.admin-user-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  padding: 9px;
}

.admin-user-activity {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}

.admin-user-activity div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-user-activity dt {
  color: rgba(248, 251, 245, 0.56);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.admin-user-activity dd {
  color: rgba(248, 251, 245, 0.88);
  font-size: 12px;
  font-weight: 750;
  margin: 0;
  overflow-wrap: anywhere;
}

.admin-password-form {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.admin-password-form input {
  padding: 8px 9px;
}

.admin-user-card strong {
  font-size: 13px;
}

.admin-user-card em {
  color: rgba(248, 251, 245, 0.68);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.search-field,
.filter-grid label {
  display: grid;
  gap: 8px;
}

.search-field span,
.filter-grid span {
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
  font-size: 14px;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
  min-height: 112px;
  line-height: 1.4;
}

option {
  color: var(--ink);
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-grid div {
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 14px 12px;
}

.stat-grid strong,
.stat-grid span {
  display: block;
}

.stat-grid strong {
  font-size: 25px;
}

.stat-grid span {
  color: rgba(248, 251, 245, 0.65);
  font-size: 12px;
  margin-top: 2px;
}

.favorites-panel {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 14px;
}

.favorites-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.favorites-head h2 {
  font-size: 16px;
}

.favorites-head button,
.favorites-list button {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  font: inherit;
}

.favorites-head button {
  flex: 0 0 auto;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
}

.favorites-head button:disabled,
.favorite-card textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.favorites-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.favorites-list p {
  color: rgba(248, 251, 245, 0.65);
  font-size: 13px;
}

.favorite-card {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  padding: 9px;
}

.favorite-card.active {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.45);
}

.favorite-card button {
  display: grid;
  gap: 3px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}

.favorites-list strong {
  font-size: 13px;
}

.favorites-list span,
.favorites-list em {
  color: rgba(248, 251, 245, 0.65);
  font-size: 12px;
  font-style: normal;
  line-height: 1.3;
}

.favorites-list em {
  color: rgba(248, 251, 245, 0.88);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-card label {
  display: grid;
  gap: 6px;
}

.favorite-card label span {
  color: rgba(248, 251, 245, 0.72);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.favorite-card textarea {
  min-height: 82px;
}

.source-note {
  margin-top: auto;
  font-size: 13px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
}

.toolbar h2 {
  font-size: 27px;
  line-height: 1.15;
}

.download-link {
  text-decoration: none;
  color: #fff;
  background: var(--green);
  padding: 11px 15px;
  border-radius: 6px;
  font-weight: 750;
  white-space: nowrap;
}

.map-panel {
  min-height: 560px;
  background: #dfe6dc;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.map-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 13px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.map-title h3 {
  font-size: 18px;
  line-height: 1.15;
}

.map-title p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.map-title span {
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  padding: 8px 10px;
  white-space: nowrap;
}

.property-map {
  width: 100%;
  min-height: 500px;
  height: 62vh;
}

.leaflet-container {
  overflow: hidden;
  position: relative;
  outline: 0;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.leaflet-control-container .leaflet-top,
.leaflet-control-container .leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-top {
  top: 10px;
}

.leaflet-right {
  right: 10px;
}

.leaflet-left {
  left: 10px;
}

.leaflet-control {
  position: relative;
  z-index: 1000;
  pointer-events: auto;
  float: left;
  clear: both;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

.leaflet-right .leaflet-control {
  float: right;
}

.leaflet-control-zoom a,
.leaflet-control-layers-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  background: #fff;
}

.leaflet-control-layers-expanded {
  padding: 8px 10px;
  min-width: 138px;
}

.leaflet-control-layers-list label {
  display: block;
  color: var(--ink);
  font-size: 13px;
  margin: 4px 0;
}

.leaflet-popup-content {
  font: 13px/1.4 Inter, ui-sans-serif, system-ui, sans-serif;
  margin: 0;
}

.leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
}

.lead-pin-preview {
  border: 0;
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(20, 31, 24, 0.22);
  color: var(--ink);
  font: 12px/1.3 Inter, ui-sans-serif, system-ui, sans-serif;
  padding: 7px 9px;
}

.lead-pin-preview strong,
.lead-pin-preview span {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-pin-preview span {
  color: var(--muted);
  margin-top: 2px;
}

.pin-card {
  width: 330px;
  background: var(--surface);
  color: var(--ink);
}

.pin-card header {
  display: grid;
  gap: 4px;
  padding: 13px 14px 11px;
  background: #f7f9f5;
  border-bottom: 1px solid var(--line);
}

.pin-card header strong {
  font-size: 15px;
  line-height: 1.2;
}

.pin-card header span,
.pin-card p,
.pin-card-opportunity {
  color: var(--muted);
}

.pin-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 0;
}

.pin-card-meta span {
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  padding: 5px 7px;
}

.pin-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px;
}

.pin-card-grid div {
  min-width: 0;
  background: #f9faf8;
  padding: 8px;
}

.pin-card-grid span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-bottom: 3px;
}

.pin-card-grid strong {
  display: block;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.pin-card p,
.pin-card-opportunity {
  padding: 0 14px 12px;
}

.pin-card-opportunity {
  line-height: 1.35;
}

.traffic-count {
  color: var(--ink);
  font-size: 22px;
  font-weight: 950;
  line-height: 1;
}

.traffic-label {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.pin-card-actions {
  padding: 0 14px 12px;
}

.pin-card-actions button {
  width: 100%;
  border: 1px solid var(--green);
  border-radius: 6px;
  background: #fff;
  color: var(--green);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  padding: 9px 10px;
}

.pin-card-actions button.active {
  background: var(--green);
  color: #fff;
}

.pin-card-memo {
  display: grid;
  gap: 6px;
  padding: 0 14px 12px;
}

.pin-card-memo span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.pin-card-memo textarea {
  min-height: 76px;
  border: 1px solid var(--line);
  background: #f9faf8;
  color: var(--ink);
}

.pin-card-memo p {
  background: #f9faf8;
  margin: 0;
  padding: 9px;
}

.pin-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 14px 14px;
}

.pin-card-links a {
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 9px;
  text-decoration: none;
}

.lead-pin {
  display: grid;
  place-items: center;
}

.lead-pin span {
  display: block;
  width: 15px;
  height: 15px;
  border: 3px solid #fff;
  border-radius: 999px;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.lead-pin.selected span {
  width: 22px;
  height: 22px;
  border-width: 4px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.2fr) minmax(380px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.lead-table-panel,
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(29, 42, 32, 0.08);
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.table-header h3 {
  font-size: 16px;
}

.table-header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.lead-table-wrap {
  max-height: 520px;
  overflow: auto;
}

.lead-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lead-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f9f5;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}

.lead-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  vertical-align: top;
}

.lead-table tr {
  cursor: pointer;
}

.lead-table tr:hover,
.lead-table tr.active {
  background: #f0f5ef;
}

.row-button {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.lead-table td span,
.lead-table td em {
  display: block;
  color: var(--muted);
  font-style: normal;
  line-height: 1.35;
  margin-top: 3px;
}

.lead-table .favorite-mark {
  display: inline-block;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  margin-right: 7px;
  text-transform: uppercase;
}

.detail-panel {
  position: sticky;
  top: 18px;
  padding: 18px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.detail-head h3 {
  font-size: 23px;
  line-height: 1.12;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--line);
  margin-top: 16px;
}

.tabs button {
  border: 0;
  border-right: 1px solid var(--line);
  background: #f7f9f5;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  padding: 10px 8px;
}

.tabs button:last-child {
  border-right: 0;
}

.tabs button.active {
  background: var(--green);
  color: #fff;
}

.tab-panel {
  margin-top: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-grid div,
.contact-card {
  background: #f9faf8;
  padding: 10px;
}

.detail-grid span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.detail-grid strong,
.contact-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.opportunity-cell .traffic-count {
  display: inline-block;
  font-size: 28px;
  margin-right: 4px;
}

.opportunity-cell .traffic-label {
  font-size: 17px;
}

.contact-card {
  margin-bottom: 10px;
}

.contact-card h4 {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.contact-card p,
.contact-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 8px;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.links a {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
  background: #fff;
}

.contact-links {
  margin-top: 12px;
}

.source-grid {
  margin-top: 12px;
}

.memo-tab-card {
  display: grid;
  gap: 14px;
}

.memo-tab-card header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  background: #f9faf8;
  padding: 12px;
}

.memo-tab-card h4 {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.memo-tab-card p,
.memo-empty {
  color: var(--muted);
  line-height: 1.45;
}

.memo-tab-card button {
  flex: 0 0 auto;
  border: 1px solid var(--green);
  border-radius: 6px;
  background: #fff;
  color: var(--green);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  padding: 9px 11px;
}

.memo-tab-card button.active {
  background: var(--green);
  color: #fff;
}

.memo-tab-card textarea {
  min-height: 180px;
  border: 1px solid var(--line);
  background: #f9faf8;
  color: var(--ink);
}

.memo-empty {
  background: #f9faf8;
  padding: 12px;
}

@media (max-width: 1100px) {
  .app-shell,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-grid,
  .stat-grid,
  .detail-grid,
  .tabs {
    grid-template-columns: 1fr;
  }

  .tabs button {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .property-map {
    min-height: 420px;
  }
}
