:root {
  --black: #000000;
  --pink: #EB4869;
  --pink-soft: rgba(235, 72, 105, 0.10);
  --grey: #F5F5F5;
  --ink: #1A1A1A;
  --ink-soft: #5B5B5B;
  --white: #FFFFFF;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.08);
  --shadow-strong: 0 20px 50px rgba(0, 0, 0, 0.16);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--grey);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2 {
  font-family: 'Playfair Display', 'Montserrat', serif;
  font-weight: 700;
}

.brand, .card-number, button, .btn-secondary, .btn-danger {
  font-family: 'Montserrat', sans-serif;
}

.topbar {
  background: var(--black);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: var(--shadow-soft);
}
.brand {
  font-weight: 700;
  font-size: 1.25rem;
  font-family: 'Playfair Display', serif;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-dot { color: var(--pink); }

.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 6px;
}
.brand-sub {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--pink);
  background: rgba(235, 72, 105, 0.15);
  padding: 3px 8px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}
nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
nav a {
  color: var(--white);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 20px;
  background: rgba(255,255,255,0.08);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s ease;
}
nav a:hover { background: var(--pink); color: var(--white); }
.who { color: rgba(255,255,255,0.65); font-size: 0.85rem; }

.nav-group { position: relative; }
.nav-group > summary {
  color: var(--white);
  list-style: none;
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 20px;
  background: rgba(255,255,255,0.08);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s ease;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { background: var(--pink); color: var(--white); }
.nav-group > summary::after { content: " \25BE"; }
.nav-group .nav-dropdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--white);
  border-radius: 14px;
  box-shadow: var(--shadow-strong);
  padding: 8px;
  min-width: 160px;
  z-index: 30;
}
.nav-group .nav-dropdown a { background: transparent; color: var(--ink); white-space: nowrap; }
.nav-group .nav-dropdown a:hover { background: var(--pink); color: var(--white); }
.nav-group.icon-only > summary { padding: 7px 10px; }

/* The Settings gear sits at the far right of the nav bar, so its dropdown
   needs to open anchored to its right edge (growing leftward) instead of
   the default left-anchored growth every other dropdown uses, or its
   contents run off the right side of the screen on narrower widths. */
.nav-group.icon-only .nav-dropdown {
  left: auto;
  right: 0;
}

@media (max-width: 768px) {
  .nav-group .nav-dropdown {
    position: static;
    box-shadow: none;
    padding: 4px 0 4px 14px;
    align-items: stretch;
    width: 100%;
    background: transparent;
  }
  .nav-group .nav-dropdown a {
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    color: var(--white);
  }
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  padding: 0;
}
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.menu-toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.is-active span:nth-child(2) { opacity: 0; }
.menu-toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.container {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  width: 100%;
}

h1 { font-size: 1.7rem; margin-bottom: 12px; color: var(--black); }
h2 { font-size: 1.2rem; margin: 28px 0 10px; color: var(--black); }

.flash {
  background: var(--pink-soft);
  border: 1px solid var(--pink);
  color: #8a0f2c;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-weight: 600;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  border-top: 4px solid var(--black);
}
.card.highlight { border-top-color: var(--pink); }
.card-number { font-size: 1.9rem; font-weight: 700; color: var(--black); font-family: 'Playfair Display', serif; }
.card-label { font-size: 0.8rem; color: var(--ink-soft); margin-top: 4px; }

/* Clickable KPI cards: same look as .card, but as a link with a subtle
   hover cue so it's clear the number can be clicked through to a filtered
   list, not just a static figure. */
a.card-link {
  display: block;
  text-decoration: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
a.card-link:hover { box-shadow: 0 6px 16px rgba(0,0,0,0.12); transform: translateY(-1px); }

/* Clickable count at the end of a leaderboard row (e.g. "72" next to a
   BDS Specialist's name), same idea, inline instead of block. */
a.leaderboard-count-link {
  color: var(--black);
  text-decoration: none;
  font-weight: 700;
}
a.leaderboard-count-link:hover { color: var(--pink); text-decoration: underline; }


.stage-row { display: flex; flex-wrap: wrap; gap: 8px; }
.stage-pill {
  background: var(--white);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(0,0,0,0.08);
}

/* ---------- Dashboard: 2-column CRM-style grid layout ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
}
.dash-main, .dash-side { display: flex; flex-direction: column; gap: 20px; }
.panel {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 18px 20px;
}
.panel h2, .panel h3 {
  margin-top: 0;
}
.panel-alert {
  border-left: 4px solid var(--pink);
}

/* Clickable pipeline-by-stage chips: replaces a flat static list with
   actual filters into the Leads page, so "pipeline by stage" is a set of
   controls rather than just numbers on the wall. */
.stage-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.stage-chip {
  display: block;
  background: var(--grey);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid rgba(0,0,0,0.06);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.stage-chip:hover { box-shadow: var(--shadow-soft); transform: translateY(-1px); }
.stage-chip .chip-count { font-size: 1.3rem; font-weight: 700; font-family: 'Playfair Display', serif; color: var(--black); }
.stage-chip .chip-label { font-size: 0.72rem; color: var(--ink-soft); display: block; margin-top: 2px; }
.stage-chip.is-empty { opacity: 0.45; }

/* Compact minimalist version: a single wrapping row of small pills
   instead of a grid of large cards, so "Pipeline by stage" reads more
   like a filter bar and takes up far less vertical space. */
.stage-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.stage-pill-compact {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--grey);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.78rem;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid rgba(0,0,0,0.07);
  white-space: nowrap;
  transition: box-shadow 0.1s ease, border-color 0.1s ease;
}
.stage-pill-compact:hover { box-shadow: var(--shadow-soft); }
.stage-pill-compact .pill-count { font-weight: 700; color: var(--black); }
.stage-pill-compact.is-empty { opacity: 0.4; }
.stage-pill-compact.is-active { border-color: var(--pink); background: var(--pink-soft); }

/* Leads-by-BDS leaderboard bars */
.bds-leaderboard-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.bds-leaderboard-name { flex: 0 0 120px; font-size: 0.8rem; font-weight: 600; }
.bds-leaderboard-track { flex: 1; background: var(--grey); border-radius: 20px; height: 10px; overflow: hidden; }
.bds-leaderboard-fill { background: var(--pink); height: 100%; border-radius: 20px; }
.bds-leaderboard-count { flex: 0 0 30px; text-align: right; font-size: 0.8rem; font-weight: 700; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

/* ---------- Lead detail page: header facts row ---------- */
.lead-header-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.08);
}
.lead-header-facts .fact-label { font-size: 0.72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.lead-header-facts .fact-value { font-size: 0.9rem; font-weight: 600; color: var(--ink); margin-top: 2px; }

.panel .prospect-form { max-width: none; margin: 0; padding: 0; box-shadow: none; border-top: none; }

/* ---------- Collapsible panels ---------- */
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.panel-collapse-btn {
  background: var(--grey);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
  margin-top: 18px;
  transition: transform 0.15s ease;
}
.panel-collapse-btn:hover { background: var(--pink-soft); color: var(--pink); }
.panel.collapsed .panel-collapse-btn { transform: rotate(-90deg); }
.panel-body { margin-top: 4px; }

/* Small, minimalist icon button for click-to-call and mailto: no circle
   backdrop, just a clean line-icon that picks up the pink accent on
   hover, sitting right next to the phone/email text. */
.icon-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  text-decoration: none;
  transition: color 0.15s ease;
}
.icon-btn:hover { color: var(--pink); }
.icon-btn svg { width: 100%; height: 100%; display: block; }
.panel.collapsed .panel-body { display: none; }

.table-wrap { overflow-x: auto; border-radius: var(--radius-md); box-shadow: var(--shadow-soft); background: var(--white); }

/* Leads table: fixed layout with sensible column widths and text
   truncation, so a normal-width screen never needs to scroll sideways to
   see every column in a row. */
table.fit-table { table-layout: fixed; width: 100%; }
table.fit-table .checkbox-col { width: 34px; }
table.fit-table th:nth-child(3), table.fit-table td:nth-child(3) { width: 24%; } /* Company */
table.fit-table th:nth-child(4), table.fit-table td:nth-child(4) { width: 19%; } /* Status */
table.fit-table th:nth-child(5), table.fit-table td:nth-child(5) { width: 14%; } /* Who owns it */
table.fit-table th:nth-child(6), table.fit-table td:nth-child(6) { width: 12%; } /* Last Activity */
table.fit-table th:nth-child(7), table.fit-table td:nth-child(7) { width: 17%; } /* Quick Actions */

.star-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: rgba(0,0,0,0.15);
  transition: color 0.15s ease;
}
.star-btn:hover { color: var(--pink); }
.star-btn.is-starred { color: var(--pink); }
.truncate-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-subtext { font-size: 0.72rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.row-link:hover { color: var(--pink); text-decoration: underline; }

/* Compact filter bar: a single dense row instead of full-height labeled
   fields, so filters don't eat up vertical space above the table. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
  padding: 8px 10px;
  background: var(--grey);
  border-radius: var(--radius-sm);
}
.filter-bar select {
  padding: 6px 10px;
  font-size: 0.82rem;
  margin: 0;
  width: auto;
}
.filter-bar-clear {
  padding: 6px 12px;
  font-size: 0.82rem;
  margin: 0;
  text-decoration: none;
  display: inline-block;
}
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 12px; text-align: left; font-size: 0.85rem; border-bottom: 1px solid rgba(0,0,0,0.06); }
th { background: var(--black); color: var(--white); font-weight: 700; }
tr:hover td { background: var(--pink-soft); }
td a { color: var(--pink); text-decoration: none; font-weight: 600; }
td a:hover { color: var(--black); }

.badge {
  background: rgba(0,0,0,0.06);
  color: var(--black);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: middle;
  box-sizing: border-box;
}

.quick-btn {
  border: none;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease;
}
.quick-btn:hover { transform: scale(1.1); }

.quick-actions-row { display: flex; gap: 4px; flex-wrap: nowrap; }

.checkbox-col { width: 34px; text-align: center; }
.table-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  margin: 0;
  background: none;
  border: 1px solid rgba(0,0,0,0.3);
  accent-color: var(--pink);
  cursor: pointer;
}

.login-box, .prospect-form {
  max-width: 420px;
  margin: 40px auto;
  background: var(--white);
  padding: 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-strong);
  display: flex;
  flex-direction: column;
  border-top: 5px solid var(--black);
}
.login-box h1 { text-align: center; }

label { margin-top: 12px; margin-bottom: 4px; font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; }
input, select, textarea {
  background: var(--grey);
  border: 1px solid rgba(0,0,0,0.12);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  width: 100%;
  font-family: 'Montserrat', sans-serif;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(235, 72, 105, 0.15);
}
textarea { min-height: 70px; resize: vertical; }

button, .btn-secondary, .btn-danger {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
button[type="submit"] { background: var(--black); color: white; box-shadow: var(--shadow-soft); }
button[type="submit"]:hover { background: var(--pink); }
.btn-secondary { background: rgba(0,0,0,0.06); color: var(--ink); display: inline-block; }
.btn-secondary:hover { background: rgba(0,0,0,0.12); }
.btn-danger { background: var(--pink-soft); color: var(--pink); width: 100%; border: 1px solid rgba(235,72,105,0.3); }
.form-actions { display: flex; gap: 10px; }
.form-actions .btn-secondary { flex: 1; }
.form-actions button { flex: 2; }

.site-footer {
  text-align: center;
  padding: 20px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  border-top: 1px solid rgba(0,0,0,0.08);
  background: var(--white);
}
.site-footer a { color: var(--pink); text-decoration: none; font-weight: 600; }
.site-footer a:hover { color: var(--black); }
.heart { color: var(--black); font-family: 'Playfair Display', serif; font-weight: 700; }

@media (max-width: 768px) {
  .topbar { position: relative; }
  .menu-toggle { display: flex; }
  nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: var(--black);
    padding: 14px;
    box-shadow: var(--shadow-soft);
    border-radius: 0 0 16px 16px;
    z-index: 20;
  }
  nav.nav-open { display: flex; }
  nav a { text-align: center; }
  .who { text-align: center; padding: 4px 0; }
}

@media (max-width: 480px) {
  .topbar { flex-direction: row; align-items: center; }
  h1 { font-size: 1.4rem; }
}

/* Responsive card layout for the "All prospects" table on small screens,
   so nothing needs horizontal scrolling on mobile. */
@media (max-width: 768px) {
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap th,
  .table-wrap td,
  .table-wrap tr {
    display: block;
  }
  .table-wrap tr:first-child {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  .table-wrap {
    overflow-x: hidden;
    box-shadow: none;
    background: transparent;
  }
  .table-wrap tr {
    width: 100%;
    margin-bottom: 14px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    background: var(--white);
    padding: 10px 14px;
    border-top: 4px solid var(--pink);
  }
  .table-wrap td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    max-width: 100%;
    text-align: left;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    overflow-wrap: anywhere;
  }
  .table-wrap td:last-child {
    border-bottom: none;
  }
  .table-wrap td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--black);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
  }
  .table-wrap td > div {
    flex-wrap: wrap;
    max-width: 100%;
  }
}
