:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #090909;
  --panel-2: #0d0d0d;
  --line: #202020;
  --line-soft: #151515;
  --text: #f5f5f5;
  --muted: #8d8d8d;
  --faint: #5f5f5f;
  --strong: #ffffff;
  --danger: #bdbdbd;
  --radius: 8px;
  --font: Inter, "SF Pro Display", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0;
  overflow: hidden;
  user-select: text;
}

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

button,
select,
input {
  color: var(--text);
  background: #070707;
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 32px;
  outline: none;
}

button {
  cursor: pointer;
  padding: 0 12px;
  font-weight: 350;
}

button:hover,
select:hover,
input:hover {
  border-color: #353535;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  border-color: #f2f2f2;
}

select,
input[type="search"] {
  padding: 0 10px;
}

input[type="range"] {
  width: 116px;
  height: 18px;
  padding: 0;
  accent-color: #f5f5f5;
}

.app-shell {
  display: grid;
  grid-template-columns: 56px 1fr;
  height: 100vh;
  min-width: 1120px;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 10px;
  border-right: 1px solid var(--line);
  background: #030303;
}

.mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #f5f5f5;
  border-radius: 7px;
  color: var(--strong);
  font-size: 11px;
  font-weight: 500;
}

.rail-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
}

.rail-button.is-active,
.rail-button:hover {
  color: var(--strong);
  background: #0b0b0b;
}

.rail-spacer {
  flex: 1;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

.topbar {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
  gap: 24px;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: #050505;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.top-actions span {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity h1,
.panel-head h2 {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 420;
}

.eyebrow {
  display: block;
  color: var(--faint);
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filters {
  display: grid;
  position: fixed;
  z-index: 45;
  top: 0;
  bottom: 0;
  left: 56px;
  width: 380px;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 14px;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: #050505;
  transform: translateX(-105%);
  transition: transform 180ms ease;
  box-shadow: 20px 0 60px rgba(0, 0, 0, 0.35);
}

.filters.is-open {
  transform: translateX(0);
}

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

.drawer-head h2 {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 390;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

label span {
  position: static;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.primary {
  align-self: end;
  background: var(--strong);
  color: #050505;
  border-color: var(--strong);
  font-weight: 430;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--line);
}

.metrics div {
  min-width: 0;
  padding: 12px 22px;
  border-right: 1px solid var(--line-soft);
}

.metrics span {
  display: block;
  color: var(--faint);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.metrics strong {
  display: block;
  margin-top: 6px;
  color: var(--strong);
  font-size: 20px;
  font-weight: 250;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) 360px;
  grid-template-rows: 404px 1fr;
  gap: 0;
  min-height: 0;
  flex: 1;
}

.table-panel,
.map-panel,
.inspector {
  min-width: 0;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.table-panel {
  grid-row: 1 / 3;
}

.inspector {
  grid-column: 2;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 62px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head.tight {
  height: 56px;
}

.panel-actions {
  display: flex;
  gap: 8px;
}

.panel-actions button,
.selection-count {
  height: 28px;
  color: var(--muted);
  background: #070707;
}

.selection-count {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  white-space: nowrap;
}

.table-wrap {
  height: calc(100% - 62px);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--faint);
  background: #080808;
  font-size: 10px;
  font-weight: 360;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

td {
  color: #dcdcdc;
  font-weight: 300;
}

tbody tr {
  cursor: pointer;
  user-select: text;
}

tbody tr:hover,
tbody tr.is-selected {
  background: #101010;
}

th:nth-child(1) { width: 34px; }
th:nth-child(2) { width: 15%; }
th:nth-child(3) { width: 20%; }
th:nth-child(4) { width: 8%; }
th:nth-child(5) { width: 7%; }
th:nth-child(6) { width: 11%; }
th:nth-child(7) { width: 11%; }
th:nth-child(8) { width: 7%; }
th:nth-child(9) { width: 13%; }
th:nth-child(10) { width: 5%; }
th:nth-child(11) { width: 8%; }

td a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: #444;
}

.row-check,
#selectAllRows {
  width: 14px;
  height: 14px;
  accent-color: #f5f5f5;
}

.tag,
.status-select {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #d6d6d6;
  background: #080808;
  font-size: 11px;
}

.status-select {
  width: 100%;
  height: 26px;
  border-radius: 6px;
  padding: 0 6px;
  color: var(--text);
}

.lead-company {
  color: var(--strong);
  font-weight: 390;
}

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

.map-panel {
  display: flex;
  flex-direction: column;
}

#leadMap {
  width: 100%;
  height: 286px;
  display: block;
  background: #070707;
}

.map-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-actions button {
  height: 26px;
  padding: 0 9px;
}

.map-note {
  color: var(--muted);
  font-size: 11px;
}

.map-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  border: 1px solid var(--text);
  vertical-align: -1px;
}

.dot.mid {
  opacity: 0.65;
}

.dot.low {
  opacity: 0.35;
}

.score {
  min-width: 48px;
  color: var(--strong);
  font-size: 26px;
  line-height: 1;
  font-weight: 180;
  text-align: right;
}

.inspector-body {
  height: calc(100% - 62px);
  overflow: auto;
  padding: 15px 16px 20px;
}

.section {
  padding: 0 0 16px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--line-soft);
}

.section:last-child {
  border-bottom: 0;
}

.section-title {
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kv {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 8px 12px;
  line-height: 1.4;
}

.kv span:nth-child(odd) {
  color: var(--faint);
}

.kv span:nth-child(even) {
  color: #e8e8e8;
}

.audit-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.audit-list li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  color: #d9d9d9;
  line-height: 1.35;
}

.audit-list i {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border: 1px solid #e8e8e8;
  border-radius: 50%;
}

.outreach {
  width: 100%;
  min-height: 142px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #ececec;
  background: #070707;
  line-height: 1.45;
}

.inspector-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.inspector-actions button {
  height: 30px;
}

.empty {
  color: var(--muted);
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: #0b0b0b;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.map-modal {
  position: fixed;
  inset: 18px;
  z-index: 50;
  display: none;
  grid-template-rows: 62px 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050505;
}

.map-modal.is-open {
  display: grid;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
}

.settings-modal.is-open {
  display: grid;
}

.settings-panel {
  width: min(620px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070707;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px;
}

.settings-grid input,
.settings-grid textarea {
  width: 100%;
}

.settings-grid textarea {
  min-height: 110px;
  padding: 10px;
  color: var(--text);
  background: #050505;
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
}

.settings-grid .wide {
  grid-column: 1 / -1;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
}

.check-line input {
  width: 14px;
  height: 14px;
  accent-color: #f5f5f5;
}

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

.map-modal-head h2 {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 390;
}

#leadMapLarge {
  min-height: 0;
}

.gm-style {
  font-family: var(--font) !important;
}

.logout-link {
  position: fixed;
  right: 18px;
  top: 14px;
  z-index: 20;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
}

.logout-link:hover {
  color: var(--text);
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .app-shell {
    min-width: 0;
    height: auto;
    grid-template-columns: 1fr;
  }

  .rail {
    display: none;
  }

  .workspace {
    height: auto;
  }

  .topbar,
  .filters,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    justify-content: stretch;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-grid {
    grid-template-rows: auto;
  }

  .table-panel,
  .map-panel,
  .inspector {
    min-height: 360px;
  }
}
