:root {
  --ink: #18212b;
  --muted: #617083;
  --line: #d8dee7;
  --panel: #ffffff;
  --soft: #f4f7fb;
  --blue: #1f5d8f;
  --blue-dark: #16466d;
  --green: #1f7a4d;
  --amber: #b46b18;
  --red: #a83c33;
  --shadow: 0 14px 40px rgba(18, 32, 48, 0.12);
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-size: 17px;
  color: var(--ink);
  background: var(--soft);
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: #152333;
  color: white;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f0b64d;
  color: #111820;
  font-weight: 800;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
}

.brand p {
  color: #b8c6d6;
  font-size: 15px;
  margin-top: 3px;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: transparent;
  color: #d9e4f0;
  text-align: left;
  padding: 0 13px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.sidebar-card {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-card span {
  color: #f0b64d;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-card strong {
  display: block;
  margin-top: 8px;
}

.sidebar-card p {
  color: #c6d4e1;
  margin: 8px 0 0;
  line-height: 1.45;
  font-size: 15px;
}

.main {
  min-width: 0;
  padding: 22px;
}

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

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar h2 {
  margin: 0;
  font-size: 32px;
}

.top-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
}

.primary-button {
  background: var(--blue);
  color: white;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.secondary-button {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--blue);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.panel,
.prospect-card,
.pipeline-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-size: 15px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.panel h3 {
  margin: 0;
  font-size: 19px;
}

.filters {
  display: grid;
  grid-template-columns: 1.8fr repeat(5, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  align-items: end; /* every dropdown has a label above it; keep the unlabeled search box level with the boxes */
}

.filters input,
.filters select,
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px;
  min-height: 40px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.mobile-list {
  display: none;
}

.mobile-prospect-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.mobile-card-main {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  color: var(--ink);
  text-align: left;
}

.mobile-card-main strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
}

.mobile-card-main small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: 15px;
}

.mobile-card-score {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #edf2f7;
  color: var(--blue);
  padding: 5px 9px;
  font-size: 14px;
  font-weight: 700;
}

.mobile-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

.mobile-prospect-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 15px;
}

th {
  color: var(--muted);
  background: #f8fafc;
  font-weight: 700;
}

tr:hover td {
  background: #f7fbff;
}

.metric-link {
  display: block;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.metric-link strong {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.metric-link.metric-plain strong {
  text-decoration: none;
}

.metric-link:hover {
  border-color: var(--blue);
}

.neighborhood {
  color: var(--muted);
  font-weight: 400;
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--blue);
  text-align: left;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 14px;
  font-weight: 700;
  background: #edf2f7;
  color: #37465a;
  white-space: nowrap;
}

.badge.high,
.badge.won {
  background: #e5f4ed;
  color: var(--green);
}

.badge.medium-high,
.badge.contacted,
.badge.quoted,
.badge.proposal-sent {
  background: #e7f0fa;
  color: var(--blue);
}

.badge.medium,
.badge.site-visit,
.badge.negotiation {
  background: #fff2df;
  color: var(--amber);
}

.badge.low,
.badge.no-patio,
.badge.lost {
  background: #fae9e7;
  color: var(--red);
}

.list-stack {
  display: grid;
  gap: 10px;
}

.prospect-card,
.pipeline-card {
  padding: 12px;
}

.prospect-card h4,
.pipeline-card h4 {
  margin: 0 0 6px;
  font-size: 17px;
}

.prospect-card p,
.pipeline-card p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pipeline-col {
  min-width: 220px;
  background: #edf2f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.pipeline-col h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.roi-layout {
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(0, 1fr);
  gap: 14px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.roi-result {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.result-box span {
  color: var(--muted);
  font-size: 15px;
}

.result-box strong {
  display: block;
  margin-top: 7px;
  font-size: 26px;
}

.drawer-backdrop { display: none !important; }

.drawer {
  display: none;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.drawer.open { display: block; }

.main.detail-open > .view { display: none !important; }

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.drawer-head-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* "Go to Follow-up" lands with the heading clear of the phone's sticky tab bar */
#followup-section {
  scroll-margin-top: 84px;
}

.drawer-head h3 {
  margin: 4px 0 0;
  font-size: 26px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-grid .span-2 {
  grid-column: 1 / -1;
}

.detail-grid + .detail-grid {
  margin-top: 12px;
}

.detail-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-sub {
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 8px;
}

.detail-head .detail-sub {
  margin: 0;
}

.verified {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

.detail-section {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.detail-section h4 {
  margin: 0 0 10px;
}

.photo-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.photo-upload select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: white;
}

.photo-picker {
  min-height: 44px;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.photo-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.photo-gallery {
  display: grid;
  gap: 16px;
}

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

.photo-tile {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.photo-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e7edf5;
}

.photo-tile figcaption {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  font-size: 14px;
  color: var(--muted);
}

.photo-tile { position: relative; }
.photo-tile.picked { border-color: #1f6feb; box-shadow: 0 0 0 2px #1f6feb; }
.photo-check { position: absolute; top: 6px; left: 6px; z-index: 1; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 6px; background: rgba(255, 255, 255, 0.92); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); cursor: pointer; }
.photo-check input { width: 22px; height: 22px; margin: 0; cursor: pointer; }
.photo-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.photo-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text, inherit); }
.photo-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.photo-toolbar .secondary-button, .photo-toolbar .primary-button { min-height: 40px; }
.photo-toolbar .primary-button:disabled { opacity: 0.45; cursor: not-allowed; }
.photo-count { font-size: 14px; color: var(--muted); }
.photo-result { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.photo-result.ok { background: #e6f4ea; color: #1e6b34; }
.photo-result.bad { background: #fdecea; color: #b3261e; }
.confirm-thumbs { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow-y: auto; margin: 8px 0; }
.confirm-thumbs img { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; background: #e7edf5; }
@media (max-width: 700px) {
  .photo-check { width: 36px; height: 36px; }
  .photo-check input { width: 26px; height: 26px; }
  .photo-toolbar .secondary-button, .photo-toolbar .primary-button { min-height: 44px; }
  .photo-toolbar .primary-button { flex: 1 1 100%; }
}

.photo-empty {
  min-height: 68px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
}

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

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px;
  }

  .brand,
  .sidebar-card {
    display: none;
  }

  .nav {
    grid-template-columns: repeat(5, 1fr);
  }

  .nav-item {
    text-align: center;
    padding: 0 8px;
  }

  .metric-grid,
  .content-grid,
  .roi-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .main {
    padding: 14px;
  }

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

  .top-actions {
    justify-content: stretch;
  }

  .top-actions button {
    flex: 1;
  }

  /* All five sections stay on screen (3 + 2 grid) instead of a row you have to swipe sideways. */
  .nav {
    overflow: visible;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .nav-item {
    min-height: 48px;
    white-space: normal;
  }

  .filters, .detail-grid, .roi-result, .photo-upload {
    grid-template-columns: 1fr;
  }

  .primary-button, .secondary-button, .ghost-button, .nav-item, .filters input, .filters select, .field input, .field select, .field textarea {
    min-height: 48px;
  }

  .topbar h2 {
    font-size: 27px;
  }

  .panel {
    padding: 12px;
  }

  .metric {
    padding: 13px;
  }

  .metric strong {
    font-size: 26px;
  }

  .mobile-list {
    display: grid;
    gap: 10px;
  }

  #prospects-view .table-wrap {
    display: none;
  }

  .drawer {
    padding: 16px;
  }

  .drawer-head {
    margin: 0 0 14px;
  }

  .drawer-head h3 {
    font-size: 23px;
  }

  .drawer-head p {
    font-size: 15px;
  }

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

  .photo-picker,
  .photo-upload select {
    min-height: 48px;
  }
}

/* Passphrase gate */
.gate-overlay { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 16px; background: #152333; }
.gate-card { width: 100%; max-width: 380px; display: grid; gap: 12px; padding: 28px 24px; border-radius: 14px; background: #ffffff; color: #18212b; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.gate-card h2 { margin: 0; font-size: 24px; }
.gate-card p { margin: 0; color: #61707f; font-size: 16px; }
.gate-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: #f2a93b; color: #152333; font-weight: 800; font-size: 15px; }
.gate-card input[type="password"] { width: 100%; padding: 11px 12px; border: 1px solid #c9d3de; border-radius: 8px; font-size: 18px; box-sizing: border-box; }
.gate-remember { display: flex; align-items: center; gap: 8px; font-size: 16px; color: #3d4b59; }
.gate-error { min-height: 18px; color: #b3261e !important; }
.gate-actions { display: flex; gap: 10px; }
.gate-actions button { flex: 1; }
.confirm-overlay { background: rgba(21, 35, 51, .6); }
.page-notice { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 1100; display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; background: #fff; border: 1px solid #c0392b; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.confirm-name { overflow-wrap: anywhere; color: #18212b !important; }

/* Drive list */
.drive-panel { margin-bottom: 18px; }
.drive-next { display: block; text-align: center; text-decoration: none; margin: 4px 0 12px; padding: 14px 16px; }
.drive-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.drive-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.drive-stop { border: 1px solid #d9e1ea; border-radius: 10px; padding: 12px; background: #fff; }
.drive-stop.done { opacity: .6; }
.drive-stop.done .link-button { text-decoration: line-through; }
.drive-stop-head { display: flex; align-items: center; gap: 10px; }
.drive-num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #152333; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.drive-info { flex: 1; min-width: 0; display: grid; }
.drive-info small { color: #5b6b7e; }
.drive-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.drive-actions a.primary-button, .drive-actions a.secondary-button, .rec-extras a.secondary-button { text-decoration: none; display: inline-flex; align-items: center; }
.drive-actions .secondary-button.active { background: #e7f0fa; border-color: #2f6db5; font-weight: 700; }
.drawer-drive { margin: 0 0 16px; align-items: center; }
.stage-field { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--muted, #5a6b7d); }
.stage-field select { min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: white; font: inherit; font-weight: 400; color: inherit; }
@media (max-width: 700px) { .stage-field select { min-height: 44px; } }
.drive-empty { color: #5b6b7e; margin: 6px 0 0; }
@media (max-width: 700px) { .drive-actions .secondary-button, .drive-actions a.primary-button, .rec-extras a.secondary-button { min-height: 44px; } }

.main, .view, .content-grid > * { min-width: 0; }
.table-wrap { overflow-x: auto; max-width: 100%; }
@media (max-width: 1000px) {
  .app-shell, .metric-grid, .content-grid, .roi-layout { grid-template-columns: minmax(0, 1fr); }
}

.sort-field { display: grid; gap: 4px; font-size: 14px; font-weight: 700; color: #5b6b7e; }

.drive-maps { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.drive-maps a { text-decoration: none; display: inline-flex; align-items: center; }
.drive-maps small { flex-basis: 100%; color: #5b6b7e; }
.drive-auto { display: flex; gap: 8px; align-items: center; font-size: 16px; margin-bottom: 12px; }

.drive-status { color: #5b6b7e; font-size: 16px; margin: 0 0 10px; min-height: 1em; }

.danger-zone { text-align: right; }
.danger-button { min-height: 40px; padding: 0 16px; border: 1px solid #c0392b; border-radius: 8px; background: white; color: #c0392b; font: inherit; font-weight: 600; cursor: pointer; }
.danger-button:hover { background: #fdecea; }
.import-error { color: #c0392b; font-weight: 600; }
.import-ok { color: #1e7a46; font-weight: 600; }

.sync-pill { border: 1px solid var(--line, #d5dde6); border-radius: 999px; padding: 6px 12px; font-size: 15px; background: #eef7f1; color: #1e7a46; cursor: pointer; white-space: nowrap; }
.sync-pill[data-state="saving"] { background: #f3f6f9; color: #5a6b7d; }
.sync-pill[data-state="offline"], .sync-pill[data-state="error"] { background: #fff4e0; color: #8a5a00; }
.sync-pill[data-state="auth"] { background: #fdecea; color: #b3261e; }
.backup-card { max-width: 520px; max-height: 90vh; overflow-y: auto; }
.gate-overlay.modal { background: rgba(21, 35, 51, 0.7); }
.backup-actions { flex-wrap: wrap; }
.backup-actions a { text-align: center; text-decoration: none; cursor: pointer; flex: 1 1 180px; box-sizing: border-box; }
.backup-card h4 { margin: 4px 0 0; }
.cutover-box { border: 2px solid #b3261e; border-radius: 10px; padding: 10px 12px; background: #fdecea; display: grid; gap: 8px; }
.cutover-box input { font-size: 16px; padding: 8px; border: 1px solid #b3261e; border-radius: 8px; width: 100%; box-sizing: border-box; }
.backup-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.backup-list li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line, #d5dde6); border-radius: 8px; font-size: 16px; }
.backup-list small { display: block; color: #5a6b7d; }
.backup-row-actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.backup-row-actions a { color: inherit; }
@media (max-width: 720px) { .sync-pill { padding: 5px 9px; font-size: 14px; } }
.backup-actions a, .backup-actions button { display: flex; align-items: center; justify-content: center; min-height: 42px; }
[hidden] { display: none !important; }
.send-goose-msg { align-self: center; font-size: 15px; }
.send-goose-msg.ok { color: #1e7a46; font-weight: 600; }
.send-goose-msg.bad { color: #b3261e; font-weight: 600; }

/* Dashboard prospect cards: drive-list button in the top right corner (bottom right on narrow screens) */
#dashboard-view .prospect-card {
  position: relative;
  padding-right: 200px;
}
#dashboard-view .prospect-card p:has(> [data-drive-add], > [data-drive-remove]) {
  margin: 0;
  height: 0;
}
#dashboard-view .prospect-card [data-drive-add],
#dashboard-view .prospect-card [data-drive-remove] {
  position: absolute;
  top: 12px;
  right: 12px;
}
@media (max-width: 700px) {
  #dashboard-view .prospect-card {
    padding-right: 14px;
    padding-bottom: 64px;
  }
  #dashboard-view .prospect-card [data-drive-add],
  #dashboard-view .prospect-card [data-drive-remove] {
    top: auto;
    bottom: 12px;
  }
}

/* Prospects table, app layout: keep the Drive List button pinned to the bottom right of each row */
@media (max-width: 700px) {
  #prospects-view table th:last-child,
  #prospects-view table td:last-child {
    position: sticky;
    right: 0;
    background: var(--panel, #fff);
    box-shadow: -6px 0 8px -6px rgba(0, 0, 0, 0.18);
  }
  #prospects-view table td:last-child {
    vertical-align: bottom;
    text-align: right;
  }
}

/* Phone prospects list: Drive List button at the bottom right of each card */
.mobile-prospect-card p:has(> [data-drive-add], > [data-drive-remove]) {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0;
}
.mobile-prospect-card p:has(> [data-drive-add], > [data-drive-remove]) > button {
  width: auto;
}

/* Referral customer checkbox: vertically centered in its grid cell, same size text as the other fields */
.check-field {
  display: flex;
  align-items: center;
}
.check-field .verified {
  gap: 10px;
  font-size: 17px;
  color: var(--ink);
}
.check-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

/* Save Activity feedback, under the button */
.activity-save-msg { margin: 0; font-size: 15px; line-height: 1.4; }
.activity-save-msg.pending { color: var(--muted); }
.activity-save-msg.ok { color: #1e7a46; font-weight: 600; }
.activity-save-msg.bad { color: #b3261e; font-weight: 600; }
.activity-save-msg.queued { color: #8a5a00; font-weight: 600; }
.activity-save-msg .queued-detail { display: block; margin-top: 2px; font-weight: 400; color: var(--muted); font-size: 14px; }
.activity-save-msg button { display: block; margin-top: 6px; }
#save-activity:disabled { opacity: 0.55; cursor: default; }

/* Activity history: the next step and follow-up date saved with an activity */
.activity-next { margin-top: 4px; color: var(--muted); font-size: 13px; }

/* Dashboard follow-up cards: the newest activity type and date, just above the Action line */
.last-activity {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92em;
  line-height: 1.35;
}

/* "Action needed": a line on list rows when filled in */
.action-tag {
  margin-top: 6px;
  color: var(--amber);
  font-size: 0.92em;
  line-height: 1.35;
}
.action-tag strong { font-weight: 700; }

/* Follow-up dates: dashboard panel and Prospects list */
.followup-date { font-weight: 700; white-space: nowrap; }
.followup-flag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.85em;
  font-weight: 700;
  white-space: nowrap;
}
.followup-flag.overdue { background: #fbe9e7; color: var(--red); }
.followup-flag.today { background: #fff3e0; color: var(--amber); }
.followup-flag.soon { background: #e8f0f8; color: var(--blue); }
.followup-card.is-overdue { border-left: 4px solid var(--red); }
.followup-more { color: var(--muted); margin: 4px 0 0; }
/* Follow-up cards have no Drive List button, so they don't need the space the other dashboard cards keep for it */
#dashboard-view .prospect-card.followup-card { padding-right: 12px; padding-bottom: 12px; }
#dashboard-view .prospect-card.followup-card.is-overdue { padding-left: 12px; }

/* Dollar amount box (Estimated deal size): "$" sits inside the left edge of the box */
.money-input { position: relative; }
.money-input span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
}
.money-input input { padding-left: 26px; }
.money-input input.invalid { border-color: var(--red); box-shadow: 0 0 0 2px #fbe9e7; }

/* Referral / Enclosure Style tags on Prospects list rows */
.list-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
td .list-tags { display: flex; margin-top: 4px; }
.badge.tag-referral { background: #e7f4ec; color: var(--green); }
.badge.tag-style { background: #dce8f2; color: #16466d; }

/* Activity the server did not take (recovery list) */
#conflict-badge { position: fixed; left: 12px; bottom: 12px; z-index: 9000; padding: 10px 14px; border: 0; border-radius: 10px; background: #b3261e; color: #fff; font-weight: 700; font-size: 15px; box-shadow: 0 4px 14px rgba(0,0,0,.3); cursor: pointer; }
.conflict-item { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid #dde4ec; }
.conflict-item h4 { margin: 0; }
.conflict-item textarea { width: 100%; box-sizing: border-box; font: 14px/1.4 ui-monospace, Menlo, Consolas, monospace; padding: 8px; border: 1px solid #c9d3de; border-radius: 8px; resize: vertical; }
.conflict-item .gate-actions { flex-wrap: wrap; }
#storage-warning { position: sticky; top: 0; z-index: 9500; padding: 10px 14px; background: #b3261e; color: #fff; font-size: 15px; line-height: 1.4; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
#storage-warning button { margin: 4px 6px 0 0; }

/* Tom's read-only login */
.viewer-banner { background: #e8eef5; color: #152333; border: 1px solid #b8c7d8; border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-weight: 700; }
.viewer-note { margin: 4px 0 0; color: #5a6b7d; font-weight: 700; }
body.viewer-mode #new-prospect { display: none !important; }
body.viewer-mode .sync-pill[data-state] { background: #e8eef5; color: #152333; }

/* Files */
.file-help { color: #5a6b7d; }
.file-items { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.file-tile { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: white; min-width: 0; }
.file-thumb { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; border-radius: 0; background: #e7edf5; overflow: hidden; }
button.file-thumb { cursor: pointer; }
.file-generic { font-weight: 700; font-size: 18px; letter-spacing: .04em; color: #5a6b7d; border: 2px solid #9db0c4; border-radius: 6px; padding: 10px 12px; background: white; }
.file-thumb canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; background: white; display: none; }
.file-tile.has-thumb .file-thumb canvas { display: block; }
.file-meta { display: grid; gap: 2px; padding: 7px 8px 0; }
.file-name { font-weight: 700; overflow-wrap: anywhere; }
.file-meta small { color: #5a6b7d; }
.file-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; margin-top: auto; }
.file-actions a.secondary-button { text-decoration: none; display: inline-flex; align-items: center; }
@media (max-width: 700px) { .file-items { grid-template-columns: repeat(2, minmax(0, 1fr)); } .file-actions .secondary-button, .file-actions .danger-button { min-height: 44px; } }

/* ---- Section 3: phone-first filters, contact actions, pager, compact pipeline ---- */
.filters-advanced { display: contents; }
.filters-toggle { display: none; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; align-items: center; }
.filter-chips:empty { display: none; }
.chip { border: 1px solid var(--line, #cfd8e3); background: #eef3f9; border-radius: 999px; padding: 6px 12px; min-height: 36px; font: inherit; cursor: pointer; }
.contact-row { display: flex; gap: 8px; align-items: stretch; }
.contact-row input { flex: 1; min-width: 0; }
.contact-link { display: inline-flex; align-items: center; justify-content: center; padding: 0 14px; min-height: 44px; border-radius: 8px; border: 1px solid var(--line, #cfd8e3); background: #eef3f9; font-weight: 700; text-decoration: none; white-space: nowrap; color: inherit; }
.contact-link[hidden] { display: none; }
/* Phone line under the box: plain text, link colour and underline only; the tap height comes from line-height. */
.plain-link { display: inline-block; padding: 0; margin: 0; border: 0; background: none; font: inherit; color: var(--link, #1a5fb4); text-decoration: underline; cursor: pointer; line-height: 44px; }
.plain-link[hidden] { display: none; }
.phone-line { display: flex; flex-wrap: wrap; gap: 0 10px; align-items: center; }
.phone-line[data-unknown] { display: none; }
.phone-line[data-unknown][data-editing] { display: flex; }
.phone-line[data-unknown] > :not(.phone-set-type) { display: none; }
.phone-line .phone-set-type { display: none; font-size: 0.85em; color: #8a8f98; text-decoration: none; }
.phone-line[data-unknown][data-editing] .phone-set-type { display: inline-block; }
.phone-type-label { text-decoration: none; font-weight: 700; }
.phone-type-label::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: currentColor; vertical-align: middle; }
.phone-type-cell { color: #1f7a4d; }
.phone-type-landline { color: #1a5fb4; }
.phone-line [data-call-link], .phone-line [data-sms-link] { font-weight: 700; text-decoration: none; }
.phone-line [data-call-link]:hover, .phone-line [data-sms-link]:hover { text-decoration: underline; }
.phone-line [data-call-link]:not([hidden]) + [data-sms-link]:not([hidden])::before { content: "\00b7"; display: inline-block; color: #8a8f98; font-weight: 400; margin: 0 8px 0 -2px; }
.call-confirm .call-cancel { color: #8a8f98; text-decoration: none; }
.call-confirm .call-now { font-weight: 700; text-decoration: none; }
.call-confirm .call-now:hover { text-decoration: underline; }
.call-confirm { flex-basis: 100%; }
.badge.tag-cell { background: #e7f4ec; color: var(--green); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 10px 0; }
.pipeline-scope { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.pipeline-scope .active { font-weight: 800; outline: 2px solid currentColor; }
.percent-input input { padding-right: 28px; }
.percent-input span { left: auto; right: 12px; }
.call-target { margin: -4px 0 10px; }
@media (max-width: 640px) {
  .filters-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .filters-advanced { display: none; }
  .filters-advanced.open { display: grid; gap: 10px; grid-template-columns: 1fr; }
  .pager .secondary-button, .chip, .contact-link { min-height: 44px; }
  .pipeline-pager { flex-wrap: nowrap; }
  .pipeline-pager .secondary-button { min-height: 44px; flex: 0 0 auto; }
  /* Compact phone filter bar: Search on its own line, then Sort and Filters side by side (all controls stay 44px tall). */
  .filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
  .filters > #filter-search { flex: 1 0 100%; min-height: 44px; }
  .filters > .sort-field { flex: 1 1 0; min-width: 0; }
  .filters .filters-toggle { flex: 0 0 auto; min-height: 44px; }
  .filters .filters-advanced.open { flex: 1 0 100%; }
  .pipeline-grid { display: grid; grid-template-columns: 1fr; overflow: visible; }
}

/* Expanded notes editor and shared notes ("Notes from Tom") */
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.expand-note { padding: 2px 10px; min-height: 0; font-size: 13px; }
/* Expand is plain text, no box; the double selector beats .ghost-button (and its mobile min-heights) */
.ghost-button.expand-note, .expand-note { border: 0; background: transparent; box-shadow: none; border-radius: 0; color: var(--purple-dark); font-weight: 700; font-size: 13px; min-height: 0; padding: 6px 4px; }
.ghost-button.expand-note:hover, .expand-note:hover { background: transparent; text-decoration: underline; }
.note-modal-overlay { background: rgba(21, 35, 51, .7); align-items: center; grid-template-rows: minmax(0, 1fr); box-sizing: border-box; }
/* .gate-card is 380px wide for the plain login; only the editor card is widened (the login card is untouched). */
.gate-card.note-modal { width: min(920px, 100%); max-width: 920px; box-sizing: border-box; max-height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.note-modal h2 { margin: 0; }
.note-modal-for { margin: 0; color: #5a6b7d; font-weight: 700; }
.note-modal textarea { flex: 1 1 40vh; width: 100%; min-height: 96px; box-sizing: border-box; resize: none; font-size: 16px; }
.note-modal textarea.note-modal-remote { flex: 0 0 auto; min-height: 90px; max-height: 22vh; background: #eef3f8; }
.note-modal-msg { margin: 0; min-height: 1.2em; font-weight: 700; }
.note-modal-msg.bad { color: #a12b2b; }
.note-modal-actions { flex: 0 0 auto; position: sticky; bottom: 0; }
.note-modal-hint { margin: 0; flex: 0 0 auto; color: #5a6b7d; font-size: 14px; }
.note-modal-history { flex: 1 1 40vh; min-height: 96px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.note-modal-entry { flex: 0 0 auto; }
.note-modal-entry-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.field-head h4 { margin: 0; }
/* Follow-up section: read-only summary, then "Log activity" in two steps */
.followup-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.followup-summary .result-box { padding: 10px 12px; }
.followup-summary .result-box strong { font-size: 17px; margin-top: 4px; overflow-wrap: anywhere; }
.followup-step { display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: white; }
.followup-step h5 { margin: 0; font-size: 16px; }
.followup-caption { margin: 0; color: var(--muted); font-size: 14px; }
.followup-step select, .followup-step input[type="date"] { min-height: 44px; }
.field-head .expand-note { flex: 0 0 auto; }
@media (max-width: 700px) { .note-modal-overlay { padding: 8px; } .note-modal textarea { flex-basis: 28vh; } .gate-card.note-modal { padding: 16px 14px; } }
.shared-note-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 0; }
.shared-note-delete { float: right; padding: 2px 10px; min-height: 0; font-size: 13px; }

/* ================= Redesign (light, card-based, mobile-first) =================
   Appended last so it restyles the existing screens without touching their behavior. */
:root {
  --ink: #16212e;
  --muted: #667085;
  --line: #dde3ea;
  --panel: #ffffff;
  --soft: #f3f6f9;
  --purple: #1f5d8f; /* name kept from the old purple theme; now SPE Navy */
  --purple-dark: #16466d;
  --purple-soft: #dce8f2;
  --blue: #1f5d8f;
  --link: #1a5fb4;
  --shadow: 0 6px 24px rgba(22, 50, 80, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
body { background: var(--soft); }
.app-shell { display: block; min-height: 100vh; }
.main { max-width: 1280px; margin: 0 auto; padding: 0 20px 48px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 0 -20px 22px; padding: 12px 20px; background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(135deg, var(--purple), #3f86c0); color: #fff; font-weight: 800; font-size: 17px; letter-spacing: -0.02em; display: grid; place-items: center; }
.brand h1 { font-size: 18px; margin: 0; line-height: 1.1; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.nav { display: flex; gap: 4px; margin-left: 8px; flex: 1 1 auto; }
.nav-item { min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 700; font-size: 16px; text-align: center; }
.nav-item:hover { background: var(--purple-soft); color: var(--purple-dark); }
.nav-item.active { background: var(--purple-soft); color: var(--purple-dark); }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.view-title-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sync-pill::before { content: "\25CF"; margin-right: 6px; font-size: 0.8em; }
.sync-pill { border-radius: 999px; font-weight: 700; }
.primary-button { background: var(--purple); border-radius: 12px; font-weight: 700; min-height: 44px; }
.primary-button:hover { background: var(--purple-dark); }
.secondary-button, .ghost-button { border-radius: 12px; min-height: 44px; }
.ghost-button { color: var(--purple-dark); }
.link-button { color: var(--purple-dark); font-weight: 700; }
#new-prospect { padding: 0 18px; }

/* shared card look */
.card, .panel, .metric, .pipeline-card, .prospect-card, .drive-stop { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.card { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3, .card-title, .rail-title { margin: 0; font-size: 13px; letter-spacing: 0.1em; color: var(--muted); font-weight: 800; }
.card-title small { font-weight: 500; letter-spacing: 0; margin-left: 8px; text-transform: none; }
.count-pill { background: var(--purple-soft); color: var(--purple-dark); font-weight: 800; border-radius: 999px; padding: 3px 12px; }
.empty-state { text-align: center; padding: 26px 12px; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }
.empty-state p { margin: 0 0 14px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.pill-chip { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font-weight: 700; }
.pill-chip.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.stat-chip { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font-size: 16px; box-shadow: var(--shadow); }
.stat-chip strong { color: var(--purple-dark); margin-right: 4px; }

/* avatars */
.avatar { flex: none; width: 46px; height: 46px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; font-size: 16px; color: #fff; }
.avatar-big { width: 84px; height: 84px; font-size: 30px; }
.tone-0 { background: #1f5d8f; } .tone-1 { background: #1f8a70; } .tone-2 { background: #d9622b; } .tone-3 { background: #2b6fd9; } .tone-4 { background: #c23b7a; } .tone-5 { background: #7a8a1f; }

/* quick actions (Call / Text / Email / Directions) */
.qa-row, .rec-actionbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qa { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--link); font-weight: 800; text-decoration: none; font-size: 16px; cursor: pointer; }
.qa:hover { background: #f4f7fd; }
.qa-primary { background: var(--purple); border-color: var(--purple); color: #fff; padding: 0 26px; }
.qa-primary:hover { background: var(--purple-dark); }
.qa-off { opacity: 0.4; background: var(--purple); color: #fff; border-color: var(--purple); cursor: default; padding: 0 26px; }
.qa-row .call-confirm, .rec-actionbar .call-confirm { flex-basis: 100%; }

/* due badges */
.due-badge { display: inline-block; padding: 3px 11px; border-radius: 999px; background: #eef0f6; color: #475467; font-weight: 800; font-size: 13px; white-space: nowrap; }
.due-badge.soon { background: #fff4d6; color: #8a5a00; }
.due-badge.today { background: #dff3e8; color: #1e7a46; }
.due-badge.overdue { background: #fde3e0; color: #b3261e; }

/* TODAY */
.today-head { margin: 4px 0 14px; }
.today-greeting { margin: 0; font-size: 36px; letter-spacing: -0.02em; }
.today-date { margin: 4px 0 0; color: var(--muted); font-size: 17px; }
.today-date strong { color: var(--purple-dark); }
.today-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.call-row { padding: 12px 0; border-top: 1px solid var(--line); }
.call-row:first-child { border-top: 0; padding-top: 0; }
.call-main { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; padding: 0; text-align: left; color: var(--ink); min-height: 52px; }
.call-text { flex: 1; min-width: 0; display: grid; }
.call-text strong { font-size: 18px; }
.call-text small { color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.call-row .qa-row { margin: 8px 0 0 58px; }
.site-visit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; align-items: start; }
.site-visit-title { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--purple-dark); font-weight: 800; }
.site-visit-details { color: var(--ink); }
.site-visit-row .qa-row .qa { min-height: 44px; }
#rec-route .secondary-button { border: 0; background: transparent; box-shadow: none; border-radius: 0; color: var(--purple-dark); font-weight: 700; font-size: 13px; min-height: 0; padding: 6px 0; }
#rec-route .secondary-button:hover { text-decoration: underline; }
.route-map { width: 100%; height: auto; border-radius: 14px; display: block; margin-bottom: 12px; }
.map-bg { fill: #e9eef7; } .map-road { fill: none; stroke: #fff; stroke-width: 9; stroke-linecap: round; } .map-park { fill: #d6ecd9; }
.map-path { fill: none; stroke: var(--purple); stroke-width: 4; stroke-dasharray: 2 8; stroke-linecap: round; }
.map-stop circle { fill: var(--purple); stroke: #fff; stroke-width: 3; } .map-stop text { fill: #fff; font-weight: 800; font-size: 14px; }
.stop-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 4px; }
.stop { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.stop.done { opacity: 0.55; }
.stop-num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--purple-soft); color: var(--purple-dark); display: grid; place-items: center; font-weight: 800; }
.stop-body { flex: 1; min-width: 0; display: grid; }
.stop-body small { color: var(--muted); }
.stop-body .link-button { text-align: left; padding: 0; font-size: 17px; }
.stop-time { color: var(--muted); font-size: 14px; white-space: nowrap; }
.route-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.route-buttons a { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; flex: 1 1 140px; }
.route-note { display: block; color: var(--muted); margin-top: 10px; font-size: 14px; }

/* PROSPECTS */
.page-head { margin: 4px 0 14px; }
.page-title { margin: 0; font-size: 34px; letter-spacing: -0.02em; }
.page-sub { margin: 4px 0 0; color: var(--muted); }
#prospects-view .filters { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 12px; box-shadow: var(--shadow); }
#prospects-view .filters > input { border-radius: 12px; min-height: 48px; }
#prospects-view #prospect-results { background: transparent; border: 0; box-shadow: none; padding: 0; }
#prospects-view #prospect-results > .panel-header { margin-bottom: 8px; }
.prospect-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.pcard-main { display: flex; gap: 14px; align-items: flex-start; border: 0; background: transparent; padding: 0; text-align: left; color: var(--ink); width: 100%; }
.pcard-text { display: grid; gap: 6px; min-width: 0; flex: 1; }
.pcard-name { font-size: 19px; line-height: 1.2; }
.pcard-place { color: var(--muted); font-size: 15px; }
.pcard-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cell-dot { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 13px; color: var(--green); }
.cell-dot i { width: 9px; height: 9px; border-radius: 50%; background: #22a05a; }
.pcard-follow { font-size: 15px; color: #475467; }
.pcard-follow.due { color: #b3261e; font-weight: 700; }
.pcard-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: auto; }
.pcard-actions .qa { min-height: 44px; padding: 0 14px; }
.pcard-drive .secondary-button { min-height: 40px; font-size: 14px; }
/* Eyes on the Quote (Today): same cards as Prospects, hairline borders, navy accent, soft green pills */
#quote-opens-card .card-head { gap: 10px; }
#quote-opens-card .qo-all { margin-left: auto; }
.qo-card { box-shadow: none; }
.qo-top { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.qo-who { cursor: default; }
.qo-pill { background: #e3f4ea; color: var(--green, #1f7a4d); font-weight: 800; font-size: 13px; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.qo-count { display: flex; align-items: baseline; gap: 8px; }
.qo-count strong { font-size: 40px; line-height: 1; letter-spacing: -0.02em; color: var(--purple-dark); }
.qo-count span { color: var(--muted); font-size: 15px; }
.qo-quiet .qo-count strong { color: #667085; }
.qo-latest { display: flex; align-items: center; gap: 8px; font-size: 15px; color: #475467; }
.qo-quiet .qo-latest { color: var(--muted); }
.qo-dot { width: 9px; height: 9px; border-radius: 50%; background: #22a35a; box-shadow: 0 0 0 3px rgba(34, 163, 90, 0.2), 0 0 8px rgba(34, 163, 90, 0.7); flex: none; }
.qo-actions { justify-content: flex-start; gap: 18px; }
.qo-toggle { margin-top: 10px; }
.qo-foot { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.qo-behind { color: var(--amber, #b46b18); font-weight: 700; }

/* RECORD */
.drawer { background: transparent; border: 0; padding: 0; }
.rec-topline { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.back-link { min-height: 44px; font-size: 17px; padding: 0; }
.rec-profile { display: flex; justify-content: flex-start; gap: 18px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 12px; }
.rec-id { min-width: 0; text-align: left; }
.rec-id h3 { margin: 0; font-size: 30px; letter-spacing: -0.02em; }
.rec-id p { margin: 3px 0 0; color: var(--muted); }
.rec-id .rec-sub { color: var(--ink); font-weight: 600; }
.rec-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.rec-pills #drawer-badge { display: inline-flex; }
.tag-pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 800; background: #eef0f6; color: #475467; }
.tag-pill.tag-ref { background: #e7f4ec; color: var(--green); } .tag-pill.tag-motor { background: #dce8f2; color: #16466d; } .tag-pill.tag-ok { background: #dff3e8; color: #1e7a46; }
.rec-actionbar { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 12px; margin-bottom: 12px; }
.rec-extras { background: transparent; margin: 0 0 12px; }
.rec-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--line); margin-bottom: 16px; scrollbar-width: none; }
.rec-tab { flex: none; min-height: 48px; padding: 0 16px; border: 0; background: transparent; color: var(--muted); font-weight: 800; font-size: 16px; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.rec-tab.active { color: var(--purple-dark); border-bottom-color: var(--purple); }
.tab-count { margin-left: 6px; background: none; color: var(--muted); border-radius: 0; padding: 0; font-size: 13px; font-weight: 400; }
.tab-count:empty { display: none; }
.rec-body { display: grid; grid-template-columns: 190px minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.rec-main { min-width: 0; display: grid; gap: 16px; }
.rec-right { display: grid; gap: 16px; }
.rec-left { position: sticky; top: 84px; }
.rec-pane { display: none; gap: 16px; }
.drawer[data-tab="overview"] .rec-pane[data-pane="overview"], .drawer[data-tab="activity"] .rec-pane[data-pane="activity"], .drawer[data-tab="notes"] .rec-pane[data-pane="notes"],
.drawer[data-tab="photos"] .rec-pane[data-pane="photos"], .drawer[data-tab="files"] .rec-pane[data-pane="files"], .drawer[data-tab="tom"] .rec-pane[data-pane="tom"] { display: grid; }
.rec-card .detail-sub { margin: 12px 0 8px; }
.contact-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
.contact-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #f7fafc; }
.contact-card .detail-grid { grid-template-columns: 1fr; }
.tap-edit .field input:not([type="checkbox"]), .tap-edit .field select { border-color: transparent; background: #f3f6f9; border-radius: 10px; }
.tap-edit .field input:hover, .tap-edit .field select:hover { border-color: var(--line); }
.tap-edit .field input:focus, .tap-edit .field select:focus { background: #fff; border-color: var(--purple); outline: none; }
.map-links { margin: 8px 0 0; color: var(--muted); }
.map-links a { color: var(--link); font-weight: 700; }
.danger-zone { text-align: left; }
.digest-note { padding: 10px 0; border-top: 1px solid var(--line); }
.digest-note:first-child { border-top: 0; }
.digest-note h5 { margin: 0 0 4px; color: var(--muted); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.digest-note p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* stage tracker */
.stage-tracker { list-style: none; margin: 14px 0 0; padding: 0; position: relative; }
.track-step { position: relative; padding-bottom: 6px; }
.track-step::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: -8px; width: 3px; background: var(--line); }
.track-step:last-child::before { display: none; }
.track-step.done::before { background: var(--purple); }
.track-step button { position: relative; display: grid; grid-template-columns: 32px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; width: 100%; min-height: 52px; padding: 4px 0; border: 0; background: transparent; text-align: left; color: var(--muted); }
.track-step button:disabled { cursor: default; }
.track-dot { grid-row: 1 / span 2; width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--line); background: #fff; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 16px; }
.track-label { font-weight: 800; font-size: 16px; }
.track-step small { font-size: 13px; color: var(--muted); grid-column: 2; }
.track-step.done .track-dot { background: var(--purple); border-color: var(--purple); }
.track-step.done .track-label { color: var(--ink); }
.track-step.now .track-dot { border-color: var(--purple); box-shadow: 0 0 0 5px var(--purple-soft); background: #fff; color: var(--purple); }
.track-step.now .track-label { color: var(--purple-dark); }
.track-step.now small { color: var(--purple-dark); font-weight: 800; }
.track-off { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

/* right rail */
.rail-card .rail-title { margin-bottom: 12px; }
.nf-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.nf-action { font-size: 17px; line-height: 1.3; }
.nf-none { color: var(--muted); margin: 0 0 12px; }
.nf-last { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.rail-card .primary-button { width: 100%; }
.story { list-style: none; margin: 0 0 10px; padding: 0; position: relative; }
.story::before { content: ""; position: absolute; left: 16px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.story-item { position: relative; display: flex; gap: 12px; padding-bottom: 14px; }
.story-icon { flex: none; z-index: 1; width: 34px; height: 34px; border-radius: 50%; background: var(--purple-soft); display: grid; place-items: center; font-size: 15px; }
.story-top { display: flex; justify-content: space-between; gap: 8px; }
.story-top small { color: var(--muted); }
.story-item p { margin: 3px 0 0; font-size: 15px; overflow-wrap: anywhere; }
.story-item .story-next { color: var(--purple-dark); font-weight: 700; }
.route-status { margin: 0 0 10px; }

/* the rest of the app wears the same clothes */
.metric-grid { gap: 14px; }
.pipeline-col { background: #e8eef4; border-radius: 18px; padding: 12px; }
.pipeline-card { padding: 12px; }
.drive-num, .stop-num { background: var(--purple-soft); color: var(--purple-dark); }
.drive-panel { padding: 18px; }
.roi-layout .panel { padding: 20px; }
.filters-toggle { min-height: 44px; }

/* "Ask Goose" request box: same card and dimmed backdrop as the other dialogs */
.goose-overlay .gate-card { max-width: 480px; }
.goose-overlay textarea { width: 100%; box-sizing: border-box; min-height: 120px; padding: 10px 12px; border: 1px solid #c9d3de; border-radius: 8px; font-size: 16px; font-family: inherit; resize: vertical; }
.goose-msg { min-height: 1.2em; }

@media (max-width: 1100px) {
  .rec-body { grid-template-columns: minmax(0, 1fr) 300px; }
  .rec-left { grid-column: 1 / -1; position: static; }
  .stage-tracker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
  .track-step::before { display: none; }
  .track-step button { grid-template-columns: 1fr; justify-items: center; text-align: center; row-gap: 4px; }
  .track-dot { grid-row: auto; }
  .track-step small { grid-column: 1; }
  .track-label { font-size: 13px; }
}
@media (max-width: 860px) {
  .today-grid, .rec-body, .site-visit-grid { grid-template-columns: minmax(0, 1fr); }
  .contact-cards { grid-template-columns: minmax(0, 1fr); }
  .rec-right { order: 3; }
}
@media (max-width: 700px) {
  .main { padding: 0 12px 40px; }
  .topbar { margin: 0 -12px 16px; padding: 10px 12px; gap: 10px; flex-direction: row; align-items: center; }
  .brand p { display: none; }
  .nav { order: 3; flex: 1 1 100%; margin: 0; overflow-x: auto; gap: 2px; scrollbar-width: none; }
  .nav-item { flex: 1 0 auto; padding: 0 12px; font-size: 15px; }
  .top-actions { margin-left: auto; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  #backup-open { padding: 0 10px; font-size: 14px; }
  .sync-pill { padding: 5px 10px; }
  .today-greeting { font-size: 28px; }
  .page-title { font-size: 28px; }
  .prospect-grid { grid-template-columns: minmax(0, 1fr); }
  .rec-profile { flex-direction: row; padding: 14px; gap: 12px; }
  .avatar-big { width: 60px; height: 60px; font-size: 22px; }
  .rec-id h3 { font-size: 23px; }
  .rec-actionbar .qa { flex: 1 1 calc(50% - 8px); }
  .rec-actionbar .qa-primary, .rec-actionbar .qa-off { flex-basis: 100%; }
  .stat-chip { font-size: 15px; }
}

/* Single-row top bar at laptop/desktop widths (>= 1024px): tighter gaps, and the brand subtitle goes at mid widths. Below 1024px the bar may wrap. */
@media (min-width: 1024px) {
  .topbar { flex-wrap: nowrap; gap: 12px; padding: 10px 20px; }
  .brand { flex: 0 0 auto; gap: 10px; }
  .brand-mark { width: 42px; height: 42px; }
  .nav { flex: 1 1 auto; min-width: 0; margin-left: 0; gap: 2px; }
  .nav-item { padding: 0 11px; font-size: 15px; white-space: nowrap; }
  .top-actions { flex: 0 0 auto; gap: 8px; }
  .top-actions button { white-space: nowrap; }
  .top-actions .secondary-button, .top-actions .primary-button { padding-left: 12px; padding-right: 12px; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .brand p { display: none; }
}