:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #fbfcff;
  --line: #e6e8ef;
  --line-strong: #d6d9e3;
  --text: #202431;
  --muted: #6f778a;
  --soft: #9097a8;
  --purple: #7b68ee;
  --blue: #2f80ed;
  --teal: #19a9a7;
  --green: #23a866;
  --amber: #d79513;
  --red: #df3f54;
  --dark: #121521;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 54px 260px minmax(0, 1fr);
  color: var(--text);
  background: var(--bg);
  font: 13px/1.42 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.rail {
  background: var(--dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
}
.rail-logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: white;
  font-weight: 900;
  font-size: 10px;
  background: linear-gradient(135deg, #7b68ee, #2f80ed 54%, #19a9a7);
}
.rail-dot {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  position: relative;
  display: block;
}
.rail-dot::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 5px;
  background: #747b91;
}
.rail-dot.active, .rail-dot:hover { background: #242838; }
.rail-dot.active::after { background: white; }
.sidebar {
  min-width: 0;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #f3f4f8;
  padding: 14px 12px;
}
.workspace-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 14px;
}
.workspace-switcher strong { display: block; font-size: 14px; }
.workspace-switcher span { display: block; color: var(--muted); font-size: 12px; }
.workspace-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: white;
  background: #333a52;
  font-weight: 900;
  font-size: 12px;
}
.new-task {
  width: 100%;
  height: 36px;
  border: 0;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--purple);
  font-weight: 800;
  box-shadow: 0 5px 16px rgba(123, 104, 238, .25);
  text-decoration: none;
}
.nav-title {
  margin: 20px 8px 8px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.nav-row, .nav-link, .space, .list-item, .status-link {
  min-height: 30px;
  width: 100%;
  border: 0;
  border-radius: 7px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #3e4555;
  background: transparent;
  text-align: left;
  text-decoration: none;
}
.space, .status-link { margin-top: 2px; font-weight: 800; justify-content: space-between; }
.list-item {
  width: calc(100% - 18px);
  margin-left: 18px;
  color: #596174;
}
.nav-row:hover, .nav-link:hover, .space:hover, .list-item:hover, .status-link:hover, .nav-row.active, .space.active, .list-item.active, .status-link.active { background: white; box-shadow: 0 1px 2px #1018280a; }
.main {
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  min-height: 88px;
  padding: 18px 26px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}
.title-wrap { min-width: 180px; }
.crumb {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: 0;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-chip {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: #3f4656;
  background: white;
}
.filter-chip.active, .filter-chip:hover { border-color: #c8cde0; background: #f7f8fc; }
.tabs {
  height: 34px;
  display: flex;
  align-items: center;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f5f6fa;
}
.tabs button {
  height: 28px;
  border: 0;
  border-radius: 5px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
}
.tabs button.active {
  color: var(--text);
  background: white;
  box-shadow: 0 1px 3px #10182812;
}
#search {
  width: 240px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--text);
  background: white;
}
.overview {
  min-height: 52px;
  padding: 10px 26px;
  display: flex;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  overflow-x: auto;
}
.stat {
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  background: white;
  color: var(--muted);
}
.stat strong { color: var(--text); font-size: 13px; }
.content {
  flex: 1;
  min-height: 0;
  padding: 18px 26px 26px;
  overflow: auto;
}
.duplicate-strip {
  margin: 12px 26px 0;
  border: 1px solid rgba(215, 149, 19, .25);
  border-radius: 8px;
  padding: 10px 12px;
  color: #72520c;
  background: #fff7de;
}
.review-strip {
  margin: 12px 26px 0;
  border: 1px solid rgba(191, 73, 73, .22);
  border-radius: 8px;
  padding: 12px;
  color: #7a271a;
  background: #fff3f0;
}
.review-strip-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 850;
}
.review-strip-head strong {
  color: #b42318;
}
.review-strip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.review-item {
  max-width: 280px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(191, 73, 73, .22);
  border-radius: 8px;
  padding: 0 10px;
  background: white;
  color: #7a271a;
  cursor: pointer;
}
.review-item span,
.review-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.review-item strong {
  color: #b42318;
  font-size: 11px;
  font-weight: 850;
}
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 292px;
  gap: 14px;
  align-items: start;
  min-height: 100%;
}
.column {
  max-height: calc(100vh - 190px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f0f2f7;
  overflow: hidden;
}
.column-title {
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 3px solid var(--purple);
  border-bottom: 1px solid var(--line);
  background: #f8f9fc;
  font-weight: 900;
  text-transform: capitalize;
}
.column-title[data-status*="complete"], .column-title[data-status*="done"] { border-top-color: var(--green); }
.column-title[data-status*="dead"], .column-title[data-status*="cancel"] { border-top-color: var(--red); }
.column-title[data-status*="mail"] { border-top-color: var(--blue); }
.column-title[data-status*="skip"] { border-top-color: var(--muted); }
.column-title[data-status*="hot"] { border-top-color: var(--red); }
.badge {
  min-width: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  background: white;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}
.column-body {
  padding: 10px;
  overflow: auto;
}
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 9px;
  cursor: pointer;
  box-shadow: 0 1px 2px #10182808;
}
.card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 12px 26px rgba(30, 34, 48, .1);
}
.task-title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 750;
}
.task-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meta, .tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.pill, .tag-pill {
  border: 0;
  max-width: 100%;
  border-radius: 999px;
  padding: 2px 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #556071;
  background: #f1f3f8;
  font-size: 11px;
  font-weight: 750;
}
.urgent { color: white; background: var(--red); }
.high { color: white; background: #e77b21; }
.normal { color: #137146; background: #dbf2e7; }
.low { color: #235fb3; background: #e6efff; }
.hot { color: white; background: var(--red); }
.d4d { color: #235fb3; background: #e6efff; }
.skip { color: #137146; background: #dbf2e7; }
.mail { color: #855f0b; background: #fff0c2; }
.list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.row, .table-row {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 150px 190px 150px 105px;
  gap: 12px;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.row:last-child, .table-row:last-child { border-bottom: 0; }
.row:hover, .table-row:hover { background: #f7f8fc; }
.table-head {
  color: var(--muted);
  background: #fbfcff;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: default;
}
.row strong, .table-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10;
  width: min(620px, 100vw);
  height: 100vh;
  padding: 18px 22px 24px;
  overflow: auto;
  transform: translateX(102%);
  transition: transform .18s ease;
  border-left: 1px solid var(--line);
  background: white;
  box-shadow: -24px 0 50px rgba(18, 21, 33, .18);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.drawer-path {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#closeDrawer {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: white;
  font-size: 22px;
}
.task-name {
  width: 100%;
  border: 0;
  outline: none;
  padding: 8px 0 14px;
  color: var(--text);
  background: white;
  font-size: 25px;
  line-height: 1.2;
  font-weight: 850;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 4px 0 14px;
}
label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
label input, label select, label textarea {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--text);
  background: white;
  font-weight: 500;
}
textarea {
  min-height: 190px;
  resize: vertical;
}
.tag-editor { margin-top: 14px; }
.tag-add { display: flex; gap: 8px; margin-top: 8px; }
.tag-add input { flex: 1; }
.tag-add button {
  border: 0;
  border-radius: 7px;
  padding: 0 12px;
  color: white;
  background: var(--purple);
  font-weight: 850;
}
.drawer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 14px 0 18px;
}
.drawer-actions a {
  margin-right: auto;
  color: var(--purple);
  text-decoration: none;
  font-weight: 800;
}
.drawer-actions button {
  height: 34px;
  border: 0;
  border-radius: 7px;
  padding: 0 14px;
  color: white;
  background: var(--purple);
  font-weight: 850;
}
.drawer-actions .danger {
  color: var(--red);
  background: #fff0f2;
}
.attachments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.attachment {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8fb;
}
.attachment img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  cursor: zoom-in;
}
.attachment a {
  display: block;
  padding: 8px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  font-size: 12px;
}
.empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: white;
}
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 40px;
  background: rgba(18, 21, 33, .86);
}
.photo-lightbox[hidden] { display: none; }
.photo-lightbox img { max-width: 96vw; max-height: 90vh; border-radius: 8px; }
.photo-lightbox button {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: rgba(255, 255, 255, .16);
  font-size: 24px;
}
.photo-lightbox-prev,
.photo-lightbox-next {
  top: 50% !important;
  transform: translateY(-50%);
}
.photo-lightbox-prev {
  left: 18px;
  right: auto !important;
}
.photo-lightbox-next {
  right: 18px;
}
.thumb {
  cursor: zoom-in;
}
@media (max-width: 980px) {
  body { grid-template-columns: 54px minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { align-items: stretch; flex-direction: column; }
  .toolbar { justify-content: flex-start; }
}
@media (max-width: 680px) {
  body { grid-template-columns: 1fr; }
  .rail { display: none; }
  .topbar { padding: 16px; }
  .overview { padding: 10px 16px; }
  .content { padding: 16px; }
  #search { width: 100%; }
  .field-grid { grid-template-columns: 1fr; }
  .row, .table-row { grid-template-columns: 1fr; gap: 4px; padding: 10px 12px; }
}

/* Classic mobile leads */
body:has(.app-header) {
  display: block;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px calc(96px + env(safe-area-inset-bottom));
  background: #f5f5f7;
  min-height: 100vh;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 -20px 20px;
  padding: calc(14px + env(safe-area-inset-top)) 20px 14px;
  background: rgba(246, 246, 248, .92);
  backdrop-filter: blur(18px);
}
.app-header h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
}
.header-actions {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
.count[hidden] {
  display: none;
}
.header-search {
  position: absolute;
  right: 104px;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(150px, 240px) auto;
  gap: 6px;
  width: min(300px, calc(100vw - 190px));
  min-width: 0;
  opacity: 0;
  transform: scaleX(.08);
  transform-origin: right center;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.header-search.open {
  opacity: 1;
  transform: scaleX(1);
  pointer-events: auto;
}
.header-search input,
.header-search button,
.header-export-btn,
.icon-btn,
.count {
  height: 34px;
  border: 1px solid rgba(60, 60, 67, .14);
  border-radius: 999px;
  background: rgba(118, 118, 128, .14);
  color: #1d1d1f;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}
.header-search input {
  min-width: 0;
  padding: 0 12px;
  background: rgba(255, 255, 255, .9);
  font-weight: 400;
}
.header-search button,
.header-export-btn {
  padding: 0 12px;
  white-space: nowrap;
}
.header-export-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: opacity .16s ease, transform .16s ease;
}
.header-actions:has(.header-search.open) .header-export-btn {
  opacity: .18;
  transform: scale(.92);
  pointer-events: none;
}
.header-actions:has(.header-search.open) #cleanup-menu-btn {
  opacity: .18;
  transform: scale(.92);
  pointer-events: none;
}
.header-export-btn svg,
.icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.export-icon {
  display: none;
}
.icon-btn {
  width: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  flex: 0 0 auto;
}
.count {
  min-width: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
}
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 25;
  width: min(760px, 100vw);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(60, 60, 67, .12);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(18px);
}
.bottom-nav .tab {
  min-height: 46px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #6e6e73;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}
.bottom-nav .tab.active,
.bottom-nav .tab:hover {
  color: #3478f6;
  background: rgba(52, 120, 246, .13);
}
.bottom-nav .add-tab {
  color: #6e6e73;
}
.bottom-nav .add-tab.active {
  color: #3478f6;
}
.lead-sort-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.lead-tools {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.status-filter-wrap {
  position: relative;
}
.lead-sort-toggle,
.status-filter-clear {
  min-height: 44px;
  border: 1px solid rgba(60, 60, 67, .14);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(118, 118, 128, .1);
  color: #1d1d1f;
  font: inherit;
  font-weight: 900;
}
.status-filter-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  padding: 10px;
  border: 1px solid rgba(60, 60, 67, .16);
  border-radius: 16px;
  background: white;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .14);
}
.status-filter-list {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(60, 60, 67, .12);
}
.sort-filter-list {
  display: grid;
  gap: 4px;
}
.status-filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 8px;
  border-radius: 10px;
  font-weight: 800;
}
.status-filter-option:hover {
  background: rgba(118, 118, 128, .08);
}
.status-filter-option input {
  width: 18px;
  height: 18px;
}
.status-filter-clear {
  width: 100%;
  margin-top: 8px;
}
.needs-review-popup {
  width: 100%;
  margin: -4px 0 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 59, 48, .26);
  border-radius: 14px;
  background: rgba(255, 59, 48, .1);
  color: #b42318;
  text-align: left;
  font: inherit;
  font-weight: 850;
}
.tasks-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) minmax(180px, 1.2fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.tasks-filter-field {
  display: grid;
  gap: 6px;
}
.tasks-toolbar label,
.status-line {
  color: #6e6e73;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.tasks-toolbar select,
.tasks-toolbar input {
  min-height: 44px;
  border: 1px solid rgba(60, 60, 67, .14);
  border-radius: 14px;
  background: rgba(255, 255, 255, .9);
  padding: 0 14px;
  font: inherit;
}
.tasks-view-toggle {
  min-height: 44px;
  display: inline-flex;
  overflow: hidden;
  border: 1px solid rgba(60, 60, 67, .14);
  border-radius: 14px;
  background: rgba(255, 255, 255, .78);
}
.tasks-view-toggle button {
  border: 0;
  background: transparent;
  padding: 0 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  color: #6e6e73;
}
.tasks-view-toggle button.active {
  background: #1d1d1f;
  color: #fff;
}
.tasks-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.task-summary-card {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid rgba(60, 60, 67, .12);
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
}
.task-summary-card span {
  color: #6e6e73;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.task-summary-card strong {
  font-size: 24px;
  line-height: 1;
}
.tasks-list {
  display: grid;
  gap: 18px;
  margin-top: 12px;
}
.tasks-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  align-items: start;
  gap: 14px;
  margin-top: 12px;
}
.task-column,
.task-list-section {
  display: grid;
  gap: 12px;
}
.task-column {
  min-height: 220px;
  padding: 12px;
  border: 1px solid rgba(60, 60, 67, .12);
  border-radius: 18px;
  background: rgba(255, 255, 255, .58);
}
.task-column > header,
.task-list-section > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #1d1d1f;
  font-weight: 900;
  text-transform: capitalize;
}
.task-column > header strong,
.task-list-section > header strong {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e8e8ed;
  font-size: 13px;
}
.task-column-cards {
  display: grid;
  gap: 10px;
}
.clickup-task-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(60, 60, 67, .12);
  border-radius: 18px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}
.clickup-task-card.compact {
  grid-template-columns: 1fr;
  padding: 12px;
}
.task-card-main {
  min-width: 0;
}
.task-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.task-status-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--task-status-color, #3478f6) 16%, #fff);
  color: color-mix(in srgb, var(--task-status-color, #3478f6) 72%, #1d1d1f);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.task-due {
  flex: 0 0 auto;
  color: #6e6e73;
  font-size: 12px;
  font-weight: 800;
}
.clickup-task-card h2 {
  margin: 0 0 7px;
  font-size: 18px;
  line-height: 1.18;
}
.clickup-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: #6e6e73;
  font-size: 13px;
  font-weight: 700;
}
.clickup-task-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 10px;
}
.task-details {
  margin-top: 10px;
}
.task-details summary {
  cursor: pointer;
  color: #3478f6;
  font-size: 13px;
  font-weight: 800;
}
.task-detail-grid,
.task-custom-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.task-detail-grid div,
.task-custom-fields div {
  display: grid;
  gap: 3px;
  padding: 9px;
  border-radius: 10px;
  background: rgba(242, 242, 247, .88);
}
.task-detail-grid span,
.task-custom-fields span {
  color: #6e6e73;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.task-detail-grid strong,
.task-custom-fields strong,
.task-details p {
  font-size: 13px;
  line-height: 1.35;
}
.task-details p {
  margin: 10px 0 0;
  color: #3a3a3c;
}
.task-open-btn {
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0 16px;
  border-radius: 14px;
  background: #1d1d1f;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.lead-sort-bar label,
.row label,
.phone-grid-head,
.info-grid span,
.info-table-head span {
  color: #6e6e73;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.lead-sort-bar select,
.lead-sort-toggle,
.status-select,
.field-readonly,
.info-grid,
.info-table,
.phone-readonly,
.phone-status-value {
  border: 1px solid rgba(60, 60, 67, .14);
  border-radius: 14px;
  background: rgba(118, 118, 128, .06);
}
.lead-sort-bar select,
.lead-sort-toggle,
.status-select {
  min-height: 44px;
  padding: 0 14px;
  font: inherit;
}
.duplicate-review,
.duplicate-resolver,
.lead {
  margin-bottom: 14px;
  border: 1px solid rgba(60, 60, 67, .12);
  border-radius: 20px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  overflow: hidden;
}
.duplicate-review {
  padding: 14px;
  background: rgba(255, 204, 0, .12);
  border-color: rgba(255, 204, 0, .26);
}
.duplicate-resolver {
  padding: 16px;
  border-color: rgba(52, 120, 246, .25);
}
.duplicate-resolver-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.duplicate-resolver-head strong,
.duplicate-card-title {
  display: block;
  font-size: 16px;
  font-weight: 900;
}
.duplicate-resolver-head span {
  display: block;
  margin-top: 4px;
  color: #d92d20;
  font-size: 13px;
  font-weight: 800;
}
.duplicate-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.duplicate-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(60, 60, 67, .12);
  border-radius: 14px;
  background: rgba(118, 118, 128, .05);
}
.duplicate-field {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
}
.duplicate-field span {
  color: #6e6e73;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.duplicate-field strong {
  min-width: 0;
  overflow-wrap: anywhere;
}
.duplicate-actions {
  margin-top: 12px;
}
.duplicate-action,
.duplicate-close,
.inline-resolve-btn {
  min-height: 36px;
  border: 1px solid rgba(60, 60, 67, .14);
  border-radius: 12px;
  padding: 0 12px;
  background: white;
  color: #1d1d1f;
  font: inherit;
  font-weight: 850;
}
.duplicate-action.primary {
  background: #1d1d1f;
  color: white;
}
.inline-resolve-btn {
  min-height: 28px;
  margin-left: 10px;
  color: #d92d20;
}
.lead-head {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 18px;
  cursor: pointer;
  user-select: text;
}
.thumb-wrap {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(118, 118, 128, .12);
}
.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lead-head-main {
  flex: 1;
  min-width: 0;
}
.addr-line {
  display: flex;
  align-items: center;
  gap: 10px;
}
.addr {
  font-size: 18px;
  font-weight: 800;
}
.score {
  min-width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #3478f6;
  color: white;
  font-weight: 800;
}
.owner {
  color: #6e6e73;
  font-weight: 800;
}
.review-reasons {
  margin-top: 5px;
  color: #d92d20;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.3;
}
.mailing,
.last-sale {
  color: #8f8f94;
  font-weight: 650;
}
.lead-head-side {
  display: grid;
  gap: 8px;
  justify-items: end;
  align-content: start;
}
.expand-btn {
  min-width: 76px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: #1d1d1f;
  color: white;
  font-weight: 800;
}
.lead.expanded .expand-btn {
  background: #ff3b30;
}
.lead-head-side .delete-btn {
  display: none;
  min-width: 76px;
  height: 34px;
  border: 0;
  border-radius: 12px;
  background: #fff0f2;
  color: var(--red);
  font-weight: 800;
}
.lead.editing .lead-head-side .delete-btn {
  display: block;
}
.tag-row {
  display: none;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 18px 16px;
}
.lead.expanded .tag-row {
  display: flex;
}
.tag {
  min-height: 36px;
  border: 1px solid rgba(60, 60, 67, .14);
  border-radius: 999px;
  padding: 0 14px;
  background: #1d1d1f;
  color: white;
  font: inherit;
  font-weight: 800;
}
.add-tag-btn {
  background: white;
  color: #1d1d1f;
}
.tag-add-select {
  min-height: 36px;
  border: 1px solid rgba(60, 60, 67, .2);
  border-radius: 999px;
  padding: 0 34px 0 14px;
  background: white;
  color: #1d1d1f;
  font: inherit;
  font-weight: 800;
}
.lead-body {
  position: relative;
  display: none;
  padding: 0 18px 18px;
  user-select: text;
}
.lead.expanded .lead-body {
  display: block;
}
.row {
  display: grid;
  gap: 7px;
  padding: 12px 0;
  border-bottom: 0;
}
.row:hover {
  background: transparent;
}
.lead-edit-all {
  position: absolute;
  right: 0;
  top: -4px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  padding: 0;
}
.field-readonly,
.info-grid,
.info-table {
  width: 100%;
  min-height: 0;
  color: #1d1d1f;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, .4fr);
  gap: 12px;
}
.info-grid > div {
  min-width: 0;
}
.info-grid strong,
.info-table-row span {
  display: block;
  overflow-wrap: anywhere;
}
.mailing-info strong {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
.mailing-row {
  grid-template-columns: minmax(160px, .34fr) minmax(0, 1fr) minmax(130px, .34fr);
  align-items: start;
}
.address-row,
.parcel-row {
  grid-template-columns: minmax(160px, .34fr) minmax(0, 1fr);
  align-items: start;
}
.address-row .address-display,
.address-row .address-input,
.parcel-row .parcel-display,
.parcel-row .parcel-url-input {
  grid-column: 2 / -1;
  width: 100%;
  max-width: none;
}
.mailing-field-label {
  white-space: nowrap;
}
.mailing-address-cell,
.mailing-source-cell {
  min-width: 0;
  color: #1d1d1f;
  font-size: 15px;
  line-height: 1.45;
}
.mailing-address-cell strong,
.mailing-source-cell strong {
  display: block;
  overflow-wrap: anywhere;
}
.mailing-source-cell span {
  display: block;
  color: #6e6e73;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.mailing-row .mailing-input {
  grid-column: 2 / 4;
}
.note-row {
  grid-template-columns: minmax(160px, .34fr) minmax(0, 1fr);
  align-items: start;
}
.note-row .note-display,
.note-row .note-input {
  grid-column: 2 / -1;
  width: 100%;
  max-width: none;
}
.skiptrace-notes-row {
  grid-template-columns: 160px minmax(0, 1fr);
  column-gap: 20px;
  align-items: start;
}
.skiptrace-notes-row .skiptrace-notes-display,
.skiptrace-notes-row .skiptrace-notes-input {
  grid-column: 2;
  width: 100%;
  max-width: none;
}
.notes-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}
.notes-list li {
  padding-left: 2px;
  overflow-wrap: anywhere;
}
.owner-table {
  display: grid;
  gap: 6px;
  width: min(420px, 100%);
}
.owner-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 14px;
}
.owner-table-row span,
.owner-table-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}
.owner-table-row strong {
  color: #6e6e73;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.info-table {
  display: grid;
  gap: 0;
}
.info-table-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.8fr) minmax(150px, .75fr) minmax(90px, .4fr);
  gap: 18px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(60, 60, 67, .12);
}
.alt-addresses-row .info-table {
  width: min(720px, 100%);
}
.alt-addresses-row .info-table-row span:first-child {
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}
.alt-addresses-row .info-table-row span:nth-child(2),
.alt-addresses-row .info-table-row span:nth-child(3) {
  white-space: nowrap;
}
.landlord-display {
  display: grid;
  gap: 8px;
}
.landlord-row {
  grid-template-columns: 160px minmax(0, 1fr);
  column-gap: 20px;
  align-items: start;
}
.landlord-row .landlord-display {
  grid-column: 2;
  width: 100%;
  max-width: 720px;
}
.landlord-summary {
  color: #166534;
  font-size: 15px;
  font-weight: 800;
}
.landlord-table {
  display: grid;
  gap: 0;
  font-size: 14px;
  width: 100%;
}
.landlord-table-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.5fr) minmax(118px, .65fr) minmax(120px, .62fr) minmax(120px, .62fr);
  gap: 18px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(60, 60, 67, .12);
}
.landlord-table-row span {
  min-width: 0;
  overflow-wrap: break-word;
}
.landlord-table-head {
  color: #6e6e73;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.landlord-table-row.current {
  color: #6e6e73;
}
.photo-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 120px));
  gap: 10px;
  align-items: start;
}
.photo-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  object-fit: cover;
  cursor: zoom-in;
}
.photo-add-mini,
.phone-add-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}
.phone-row-section > label {
  display: none;
}
.phone-table {
  display: grid;
  gap: 14px;
}
.phone-owner-group {
  display: grid;
  gap: 0;
}
.phone-owner-label {
  padding: 4px 0 6px;
  color: #1d1d1f;
  font-size: 14px;
  font-weight: 850;
}
.phone-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(86px, .55fr) minmax(96px, .7fr) minmax(110px, .7fr);
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(60, 60, 67, .12);
}
.phone-grid-head {
  padding-bottom: 4px;
}
.phone-readonly {
  display: block;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-weight: 650;
}
.phone-status-value {
  min-height: 38px;
  padding: 0 10px;
  font: inherit;
}
.export-help {
  margin: -4px 0 10px;
  color: #6e6e73;
  font-size: 13px;
}
.export-field-list {
  display: grid;
  gap: 8px;
}
.export-field-row {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.export-field-row label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.export-order-actions {
  display: inline-flex;
  gap: 6px;
}
.export-order-actions button {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(60, 60, 67, .14);
  border-radius: 999px;
  background: rgba(118, 118, 128, .1);
  color: #1d1d1f;
  font-weight: 900;
}
.lead:not(.editing) .lead-body input:not([type="hidden"]),
.lead:not(.editing) .lead-body textarea,
.lead:not(.editing) .lead-body select:not(.phone-status-value):not(.status-select),
.lead:not(.editing) .photo-controls,
.lead:not(.editing) .row.actions,
.lead:not(.editing) .owner-edit-fields {
  display: none;
}
.lead.editing .field-readonly,
.lead.editing .info-grid,
.lead.editing .info-table,
.lead.editing .status-display,
.lead.editing .owner-display,
.lead.editing .email-display,
.lead.editing .skiptrace-notes-display,
.lead.editing .note-display,
.lead.editing .sale-price-display,
.lead.editing .sale-seller-display,
.lead.editing .sale-doc-display {
  display: none;
}
.lead.editing .lead-body input:not([type="hidden"]),
.lead.editing .lead-body textarea,
.lead.editing .lead-body select,
.lead.editing .row.actions {
  display: block;
}
.lead.editing .owner-edit-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px;
  gap: 8px;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .28);
}
.modal-backdrop[hidden] {
  display: none;
}
.modal {
  width: min(560px, 100%);
  max-height: 86vh;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(60, 60, 67, .14);
  background: white;
  padding: 18px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, .16);
}
.modal-head,
.export-columns-head,
.export-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal h2 {
  margin: 0;
}
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  padding: 0;
}
.export-filter-label,
.export-columns-head span {
  display: block;
  margin: 14px 0 6px;
  color: #6e6e73;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
#export-filter {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(60, 60, 67, .14);
  border-radius: 12px;
  padding: 0 12px;
  font: inherit;
}
.export-field-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.export-field-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  font-weight: 650;
}
.cleanup-options {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.cleanup-option {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(60, 60, 67, .14);
  border-radius: 12px;
  background: rgba(118, 118, 128, .06);
  font-weight: 750;
}
.cleanup-option input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
#cleanup-status {
  margin-top: 12px;
}
.export-actions {
  justify-content: flex-end;
  margin-top: 16px;
}
@media (max-width: 680px) {
  body:has(.app-header) {
    padding: 0 14px calc(88px + env(safe-area-inset-bottom));
  }
  .app-header {
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
    padding-right: 14px;
    gap: 8px;
  }
  .app-header h1 {
    font-size: 28px;
  }
  .header-actions {
    gap: 6px;
  }
  .header-export-btn,
  .icon-btn,
  .count {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
  }
  .export-label {
    display: none;
  }
  .export-icon {
    display: block;
  }
  .header-search {
    position: absolute;
    left: auto;
    right: 92px;
    top: calc(12px + env(safe-area-inset-top));
    z-index: 3;
    width: min(230px, calc(100vw - 178px));
    grid-template-columns: 1fr;
  }
  .header-search input {
    height: 38px;
    font-size: 16px;
  }
  .header-search button {
    display: none;
  }
  .lead-sort-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }
  .lead-sort-bar select {
    width: 100%;
  }
  .tasks-toolbar {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .tasks-toolbar select,
  .tasks-toolbar input {
    width: 100%;
  }
  .tasks-toolbar input,
  .tasks-view-toggle {
    grid-column: 1 / -1;
  }
  .tasks-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tasks-board {
    grid-template-columns: 1fr;
  }
  .clickup-task-card {
    grid-template-columns: 1fr;
  }
  .task-open-btn {
    justify-self: start;
  }
  .addr {
    font-size: 17px;
  }
  .lead-head {
    padding: 16px;
  }
  .lead-body,
  .tag-row {
    padding-left: 16px;
    padding-right: 16px;
  }
  .info-table-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .phone-grid {
    grid-template-columns: minmax(108px, 1.15fr) minmax(72px, .7fr) minmax(86px, .85fr) minmax(104px, .95fr);
    gap: 6px;
    overflow-x: auto;
    font-size: 14px;
  }
  .phone-status-value {
    min-height: 34px;
    padding: 0 8px;
    font-size: 14px;
  }
  .mailing-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .mailing-row .mailing-input {
    grid-column: auto;
  }
  .note-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .note-row .note-display,
  .note-row .note-input {
    grid-column: auto;
  }
  .skiptrace-notes-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .skiptrace-notes-row .skiptrace-notes-display,
  .skiptrace-notes-row .skiptrace-notes-input {
    grid-column: auto;
  }
  .landlord-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .landlord-row .landlord-display {
    grid-column: auto;
  }
  .phone-grid-head {
    display: grid;
  }
  .info-table-head {
    display: none;
  }
  .export-field-list {
    grid-template-columns: 1fr;
  }
}
