/* Black-and-white theme with a Notion-style sidebar. */
:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --text: #191919;
  --muted: #787774;
  --faint: #a5a4a0;
  --border: #e9e9e7;
  --hover: rgba(55, 53, 47, 0.06);
  --active: rgba(55, 53, 47, 0.09);
  --sidebar: #f7f7f5;
  --accent: #191919;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  display: flex;
  min-height: 100vh;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

svg:not(.leaflet-container svg) { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  color: #5f5e5b;
  display: flex;
  flex-direction: column;
  padding: 6px 0 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  font-size: 14px;
}
body.sidebar-collapsed .sidebar { display: none; }

.workspace {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 6px 10px;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--text);
  font-weight: 600;
}
.workspace:hover { background: var(--hover); }
.workspace-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--text);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.workspace-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
  border: none;
  background: none;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--faint);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { background: var(--active); color: var(--text); }
.workspace .icon-btn { opacity: 0; }
.sidebar:hover .workspace .icon-btn { opacity: 1; }

.nav-section {
  padding: 10px 14px 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--faint);
}

nav a, .nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 1px 6px;
  padding: 5px 8px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}
nav a:hover, .nav-btn:hover { background: var(--hover); }
nav a.active { background: var(--active); color: var(--text); }
nav a svg, .nav-btn svg { color: #91918e; }
nav a.active svg { color: var(--text); }
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-count { font-size: 12px; color: var(--faint); font-weight: 400; }

.nav-btn {
  width: calc(100% - 12px);
  border: none;
  background: none;
  font: inherit;
  font-weight: 500;
  text-align: left;
}

.sidebar-footer { margin-top: auto; }

/* ---------- Main ---------- */
main { flex: 1; min-width: 0; padding: 28px 48px; }
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.topbar h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.01em; flex: 1; }
.topbar-actions { display: flex; gap: 8px; }
#expand-btn { display: none; font-size: 16px; }
body.sidebar-collapsed #expand-btn { display: inline-block; }

button, input, select, textarea { font: inherit; color: inherit; }
button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  cursor: pointer;
}
button:hover { background: var(--hover); }
button.primary { background: var(--text); border-color: var(--text); color: #fff; }
button.primary:hover { background: #333; }
button.danger { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

input, select, textarea {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
textarea { min-height: 70px; resize: vertical; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; }
.toolbar input { max-width: 280px; background: var(--sidebar); border-color: transparent; }
.toolbar input:focus { background: #fff; }
.toolbar .count { margin-left: auto; color: var(--muted); font-size: 13px; }

/* Stage summary strip */
.stage-strip { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.stage {
  flex: 1;
  min-width: 110px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
}
.stage:hover { background: var(--hover); }
.stage.selected { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.stage .label { color: var(--muted); font-size: 12px; }
.stage .num { font-size: 20px; font-weight: 600; }
.stage .sub { font-size: 12px; color: var(--muted); }

/* Table */
.table-wrap { border-top: 1px solid var(--border); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th + th, td + td { border-left: 1px solid var(--border); }
th {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
th:hover { background: var(--hover); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--hover); }
td.num, th.num { text-align: right; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

th .sort-arrow { color: #d3d3d1; font-size: 10px; }
th:hover .sort-arrow { color: var(--muted); }
th.sorted { color: var(--text); }
th.sorted .sort-arrow { color: var(--text); }

/* Badges: shades of gray, from neutral to solid black */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 12px;
  background: #f1f1ef;
  color: var(--text);
  border: 1px solid transparent;
}
.badge.blue   { background: #e3e2e0; }
.badge.purple { background: #cfcfcc; }
.badge.amber  { background: #fff; border-color: var(--text); font-weight: 600; }
.badge.green  { background: var(--text); color: #fff; }
.badge.red    { background: #fff; border-color: #d3d3d1; color: var(--muted); text-decoration: line-through; }

.flag { color: var(--text); font-weight: 700; }
.flag::before { content: "● "; font-size: 9px; vertical-align: 1px; }
.truncate { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.muted { color: var(--faint); }
input:disabled { background: var(--sidebar); color: var(--muted); }

/* ---------- Dashboard ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.kpi, .panel { border: 1px solid var(--border); border-radius: 6px; padding: 16px; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 700; margin: 6px 0 2px; }
.kpi .sub { color: var(--muted); font-size: 12px; }
.panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 12px;
}
.panel h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.panel ul { list-style: none; margin: 0; padding: 0; }
.panel li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 6px;
  margin: 0 -6px;
  border-radius: 4px;
  border-bottom: 1px solid var(--border);
}
.panel li:hover { background: var(--hover); }
.panel li:last-child { border-bottom: none; }
.panel li > span:last-child { text-align: right; }
.panel li .meta { color: var(--muted); font-size: 12px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.bar-row .name { width: 110px; color: var(--muted); font-size: 12px; }
.bar-row .bar { flex: 1; height: 8px; background: #f1f1ef; border-radius: 4px; overflow: hidden; }
.bar-row .bar span { display: block; height: 100%; background: var(--text); }
.bar-row .val { width: 40px; text-align: right; font-size: 12px; }

/* ---------- Dialog ---------- */
dialog {
  border: none;
  border-radius: 8px;
  padding: 0;
  width: min(680px, 94vw);
  box-shadow: 0 0 0 1px rgba(15,15,15,0.05), 0 5px 10px rgba(15,15,15,0.1), 0 15px 40px rgba(15,15,15,0.2);
}
dialog::backdrop { background: rgba(15, 15, 15, 0.4); }
#record-form { padding: 0 28px 24px; }
/* Title, Cancel and Save stay pinned at the top while the form scrolls. */
.dialog-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; margin: 0 -28px 18px; padding: 18px 28px 14px; background: #fff; border-bottom: 1px solid var(--border); }
#record-form h2 { flex: 1; margin: 0; font-size: 20px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form-grid label.full { grid-column: 1 / -1; }
.dialog-actions { display: flex; gap: 8px; margin-top: 22px; }
.spacer { flex: 1; }

/* ---------- Document checklist ---------- */
.checklist { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; padding: 4px 0; }
.form-grid label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.check input { width: auto; accent-color: var(--text); }

/* ---------- Ask AI chat panel ---------- */
.chat {
  width: 380px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: #fff;
}
.chat[hidden] { display: none; }
.chat-header { display: flex; align-items: center; gap: 4px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.chat-title { flex: 1; font-weight: 600; }
#chat-clear-btn { font-size: 12px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 12px; }
.chat-intro p { margin: 0 0 12px; color: var(--muted); }
.chat-suggestions { display: flex; flex-direction: column; gap: 6px; }
.chat-suggestions button { text-align: left; font-size: 13px; }
.bubble { line-height: 1.5; max-width: 100%; overflow-wrap: anywhere; }
.bubble p { margin: 0 0 6px; }
.bubble ul { margin: 4px 0 8px; padding-left: 18px; }
.bubble code { background: #f1f1ef; padding: 0 4px; border-radius: 3px; font-size: 12px; }
.bubble.user { align-self: flex-end; background: #f1f1ef; padding: 8px 12px; border-radius: 10px; max-width: 85%; }
.bubble.assistant { align-self: stretch; }
.csv-download { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); text-decoration: none; }
.csv-download:hover { background: #f1f1ef; }
.csv-download > span:first-child { font-size: 18px; }
.csv-download strong { display: block; font-weight: 600; }
.csv-download small { color: var(--muted); font-size: 12px; }
.bubble.error { color: var(--muted); border-left: 2px solid var(--text); padding-left: 10px; }
.typing { color: var(--faint); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding: 12px 14px; border-top: 1px solid var(--border); }
.chat-input textarea { min-height: 38px; max-height: 140px; resize: none; }
.chat-input button { height: 38px; width: 38px; padding: 0; flex-shrink: 0; font-size: 16px; }
.chat-input button:disabled { opacity: 0.4; cursor: default; }
@media (max-width: 1200px) {
  .chat { position: fixed; right: 0; top: 0; z-index: 10; box-shadow: -8px 0 24px rgba(15,15,15,0.08); max-width: 100vw; }
}

/* ---------- View tabs (Board / Table) ---------- */
.view-tabs { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.view-tabs button { border: none; border-radius: 0; padding: 6px 12px; color: var(--muted); }
.view-tabs button + button { border-left: 1px solid var(--border); }
.view-tabs button.active { background: var(--text); color: #fff; }
.check-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; cursor: pointer; }
.check-toggle input { width: auto; accent-color: var(--text); }
tr.removed td { color: var(--faint); }

/* ---------- Sales board (HubSpot-style) ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: start;
}
.board-col {
  background: var(--sidebar);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  min-height: 420px;
}
.col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  border-radius: 6px 6px 0 0;
}
.col-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.col-count { font-size: 12px; color: var(--muted); background: #ececea; border-radius: 10px; padding: 0 7px; }
.col-body { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; border-radius: 4px; }
.col-body.drop-target { background: #ececea; outline: 2px dashed var(--text); outline-offset: -6px; }
.col-empty { color: var(--faint); font-size: 12px; text-align: center; padding: 20px 0; }
.col-foot { padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); background: #fff; border-radius: 0 0 6px 6px; }
.col-foot strong { color: var(--text); }

.deal-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.04);
}
.deal-card:hover { border-color: #c7c7c5; box-shadow: 0 2px 6px rgba(15, 15, 15, 0.08); }
.deal-card.dragging { opacity: 0.4; }
.deal-top { display: flex; align-items: flex-start; gap: 6px; }
.deal-name { flex: 1; font-weight: 600; text-decoration: underline; text-decoration-color: #d3d3d1; text-underline-offset: 3px; }
.card-menu-btn { border: none; background: none; padding: 0 4px; color: var(--faint); font-size: 16px; line-height: 1; }
.card-menu-btn:hover { color: var(--text); background: var(--hover); }
.deal-fields { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 8px 0; font-size: 13px; }
.deal-fields dt { color: var(--muted); }
.deal-fields dd { margin: 0; display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text); color: #fff; font-size: 9px; font-weight: 700;
}
.deal-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 6px; }

.card-menu {
  position: absolute;
  top: 30px;
  right: 8px;
  z-index: 5;
  width: 190px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(15, 15, 15, 0.12);
  padding: 4px;
  cursor: default;
}
.card-menu button { display: block; width: 100%; text-align: left; border: none; padding: 6px 8px; font-size: 13px; }
.menu-label { font-size: 11px; color: var(--faint); padding: 8px 8px 2px; border-top: 1px solid var(--border); margin-top: 4px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--text);
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(15, 15, 15, 0.25);
}
.update-banner { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1100; display: flex; align-items: center; gap: 14px; background: var(--text); color: #fff; padding: 10px 10px 10px 16px; border-radius: 6px; font-size: 13px; box-shadow: 0 6px 20px rgba(15, 15, 15, 0.25); }
.update-banner button { background: #fff; color: var(--text); border: none; padding: 5px 12px; font-weight: 600; }
.update-banner button:hover { background: #e9e9e7; }
.toast-undo { background: none; border: 1px solid #555; color: #fff; padding: 3px 10px; }
.toast-undo:hover { background: #333; }

/* ---------- Card quick actions + removed screen ---------- */
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.card-action { padding: 3px 8px; font-size: 12px; color: var(--muted); background: #fff; }
.card-action:hover { color: var(--text); border-color: var(--text); background: #fff; }
.deal-card.is-removed { cursor: pointer; }
.deal-card.is-removed .deal-name { color: var(--muted); }
.member-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.ms-total { margin-right: 6px; }
.ms-total strong, .ms-chip strong { color: var(--text); font-weight: 600; }
.ms-chip { padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; background: #fff; }
/* ---------- Sign-in ---------- */
#auth-screen { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: var(--sidebar); padding: 24px; }
#auth-screen[hidden] { display: none; }
body.signed-out > aside.sidebar, body.signed-out > main, body.signed-out > #chat { visibility: hidden; }
.auth-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 32px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(15,15,15,0.08); }
.auth-card h1 { margin: 4px 0 0; font-size: 22px; font-weight: 700; }
.auth-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.auth-intro { margin: 0; color: var(--muted); line-height: 1.5; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.auth-msg { margin: 0; min-height: 1em; font-size: 13px; color: var(--text); }
.auth-msg:empty { display: none; }
.auth-submit { height: 38px; }
.auth-submit:disabled { opacity: 0.5; }
.auth-links { display: flex; justify-content: center; font-size: 13px; }
.auth-links:empty { display: none; }
.account { display: flex; align-items: center; gap: 8px; padding: 6px 8px 10px; }
.account[hidden] { display: none; }
.account-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.account-email { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-role { font-size: 12px; color: var(--muted); }
#signout-btn { font-size: 12px; }
.demo-note { margin: 0 8px 8px; font-size: 12px; color: var(--muted); }
.demo-note[hidden], #role-picker[hidden], .nav-btn[hidden] { display: none; }

/* ---------- Provider recruitment map ---------- */
.map-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 12px; }
.map-filter { width: auto; max-width: 260px; padding: 5px 8px; font-size: 13px; }
.map-filter.active { border-color: var(--text); font-weight: 600; }
.map-wrap { position: relative; }
#recruit-map { height: min(600px, calc(100vh - 230px)); min-height: 360px; border: 1px solid var(--border); border-radius: 8px; background: var(--sidebar); z-index: 0; }
#recruit-map .leaflet-tile-pane { filter: grayscale(1) contrast(1.05); } /* black-and-white base map */
.map-loading { display: grid; place-items: center; height: 100%; color: var(--muted); }
.map-legend { position: absolute; left: 12px; bottom: 12px; z-index: 500; display: flex; flex-wrap: wrap; gap: 10px; padding: 6px 10px; background: #fff; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.map-legend span, .map-pop-status { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i, .map-pop-status i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.map-pop { font: 13px/1.4 inherit; min-width: 200px; }
.map-pop strong { font-size: 14px; }
.map-pop-status { margin: 2px 0 6px; color: var(--muted); }
.map-pop dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 8px; }
.map-pop dt { color: var(--muted); }
.map-pop dd { margin: 0; }
.map-open { padding: 4px 10px; font-size: 12px; }
.map-note { margin-top: 10px; font-size: 13px; color: var(--muted); }
.link-btn { border: none; background: none; padding: 0; color: var(--text); text-decoration: underline; font-size: inherit; }
.link-btn:hover { background: none; }
.board-2 { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
.screen-intro { margin: -12px 0 16px; color: var(--muted); }
.toast-link { background: none; border: none; color: #fff; text-decoration: underline; padding: 3px 4px; }
.toast-link:hover { background: none; color: #ccc; }

/* ---------- Notion-style toggles ---------- */
.toggle.top { margin-top: 18px; }
.groups .toggle.top { margin-top: 2px; }
.toggle-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: none;
  padding: 6px 6px;
  border-radius: 4px;
  text-align: left;
  font-weight: 500;
}
.toggle-head:hover { background: var(--hover); }
.caret { display: inline-block; width: 14px; color: var(--muted); font-size: 11px; transition: transform 0.12s; }
.caret.open { transform: rotate(90deg); }
.toggle-title { font-weight: 600; }
.toggle-count { color: var(--faint); font-size: 13px; }
.toggle-sub { color: var(--muted); font-size: 12px; margin-left: auto; }
.toggle-body { padding-left: 22px; margin-bottom: 6px; }
.toggle.nested .toggle-head { padding: 5px 6px; }
.toggle-empty { color: var(--faint); font-size: 13px; padding: 6px 8px; }
.toggle.is-empty .toggle-head { color: var(--faint); }
.toggle-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.toggle-label select { width: auto; padding: 5px 8px; }

/* Removed-deal list rows */
.list-head, .list-row {
  display: grid;
  grid-template-columns: 2fr 1.6fr 1.4fr 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  font-size: 13px;
}
.list-head { color: var(--faint); font-size: 12px; border-bottom: 1px solid var(--border); }
.list-row { border-bottom: 1px solid var(--border); border-radius: 4px; cursor: pointer; }
.list-row:hover { background: var(--hover); }
.list-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.list-row .num, .list-head .num { justify-content: flex-end; text-align: right; }
.list-row .strong { font-weight: 600; }
.row-actions { justify-content: flex-end; }

/* Provider rows */
.prov { border-radius: 6px; }
.prov.open { border: 1px solid var(--border); margin: 6px 0; }
.prov-row {
  display: grid;
  grid-template-columns: 14px minmax(160px, 2fr) minmax(110px, 1fr) auto minmax(140px, 1fr) 90px;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: none;
  padding: 8px 8px;
  text-align: left;
}
.prov.open .prov-row { border-bottom: 1px solid var(--border); }
.prov-row:hover { background: var(--hover); }
.prov-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prov-spec { color: var(--muted); font-size: 13px; }
.cred { display: flex; align-items: center; gap: 8px; }
.cred-bar { flex: 1; height: 6px; background: #ececea; border-radius: 3px; overflow: hidden; }
.cred-bar span { display: block; height: 100%; background: var(--text); }
.cred-num { font-size: 12px; color: var(--muted); width: 28px; }
.cred-status { font-size: 12px; color: var(--muted); }
.cred-status.done { color: var(--text); font-weight: 600; }

/* Expanded provider card */
.prov-card { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; padding: 16px 18px 18px 30px; }
.pc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.pc-field { display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }
.pc-field > span:last-child { display: flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.pc-label { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; }
.pc-notes { margin-top: 14px; }
.pc-notes p { margin: 2px 0 0; font-size: 13px; }
.pc-docs { border-left: 1px solid var(--border); padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.pc-docs-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.pc-doc { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; padding: 2px 0; }
.pc-doc.have { color: var(--text); }
.pc-doc input { width: auto; accent-color: var(--text); }
.pc-actions { margin-top: 10px; }
@media (max-width: 900px) {
  .prov-card { grid-template-columns: 1fr; }
  .pc-docs { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 12px; }
}

.badge { white-space: nowrap; flex-shrink: 0; }

/* ---------- Provider groups list ---------- */
.group-list { border-top: 1px solid var(--border); }
.group-list-head, .group-row {
  display: grid;
  grid-template-columns: 14px minmax(200px, 2.2fr) 1fr 1fr 1.2fr minmax(130px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 8px;
}
.group-list-head { font-size: 12px; color: var(--faint); border-bottom: 1px solid var(--border); }
.group-row { border-bottom: 1px solid var(--border); cursor: pointer; }
.group-row:hover { background: var(--hover); }
.group-row > span { display: flex; align-items: center; gap: 6px; min-width: 0; }
.group-name { font-weight: 600; flex-direction: column; align-items: flex-start !important; gap: 0 !important; }
.group-spec { font-weight: 400; font-size: 12px; color: var(--muted); }
.muted-text { color: var(--muted); font-size: 13px; }
.cred-num.wide { width: auto; white-space: nowrap; }
.group.open > .group-row { background: var(--sidebar); }

.member-list { padding: 4px 8px 10px 34px; border-bottom: 1px solid var(--border); background: #fcfcfb; }
.member-head, .member-row {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) 1fr 1fr minmax(130px, 1fr) 140px;
  gap: 12px;
  align-items: center;
  padding: 7px 8px;
  font-size: 13px;
}
.member-head { font-size: 12px; color: var(--faint); }
.member-row { border-top: 1px solid var(--border); border-radius: 4px; cursor: pointer; }
.member-row:hover { background: var(--hover); }
.member-name { font-weight: 500; }
.add-member { margin-top: 6px; border: none; background: none; color: var(--muted); padding: 6px 8px; font-size: 13px; }
.add-member:hover { color: var(--text); background: var(--hover); }

/* ---------- Provider full view ---------- */
.title-suffix { font-weight: 400; color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); margin: -14px 0 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.detail-status { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.detail-status .badge { font-size: 13px; padding: 3px 10px; }
.detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 20px; align-items: start; }
.detail-main { display: flex; flex-direction: column; gap: 16px; }
.detail-section { border: 1px solid var(--border); border-radius: 6px; padding: 16px 18px; }
.detail-section h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.detail-side { display: flex; flex-direction: column; gap: 16px; }
.pc-grid.one { grid-template-columns: 1fr; }
.side-group-name { font-weight: 600; margin-bottom: 12px; }
.detail-side .card-action { margin-top: 12px; }
.side-member { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 4px; color: inherit; text-decoration: none; font-size: 13px; }
.side-member:hover { background: var(--hover); }
.cred.big { margin-bottom: 14px; }
.cred.big .cred-bar { height: 8px; }
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.missing-tag { font-size: 11px; color: var(--muted); border: 1px solid #d3d3d1; border-radius: 3px; padding: 0 5px; margin-left: 4px; }
.kpi-unit { font-size: 14px; font-weight: 500; color: var(--muted); }
@media (max-width: 1000px) { .detail { grid-template-columns: 1fr; } }

/* ---------- Sales subfolders, roles, overview ---------- */
.nav-sub a { padding-left: 30px; font-weight: 400; font-size: 13px; }
.nav-sub a[hidden] { display: none; }
.role-picker { padding: 2px 14px 8px; }
.role-picker select { font-size: 13px; padding: 5px 8px; background: #fff; }
.line-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.line-card { display: block; border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px; color: inherit; text-decoration: none; }
.line-card:hover { background: var(--hover); }
.line-name { font-weight: 700; font-size: 16px; display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.line-stats { display: flex; gap: 28px; }
.line-stats > div { display: flex; flex-direction: column; }
.line-num { font-size: 20px; font-weight: 700; }
.line-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; border: 1px solid var(--text); border-radius: 3px; padding: 0 4px; flex-shrink: 0; }

/* Collapsible Sales folders in the sidebar */
.nav-parent { position: relative; }
.nav-caret {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px; margin-left: -4px; margin-right: -4px;
  border-radius: 3px; color: var(--faint); font-size: 10px;
  transition: transform 0.12s;
}
.nav-caret:hover { background: var(--active); color: var(--text); }
.nav-caret.open { transform: rotate(90deg); }
.nav-sub[hidden] { display: none; }
/* No sales access: Provider Recruitment sits at the top level instead of inside Sales. */
#nav.no-sales .nav-sub, #nav.no-sales .nav-sub[hidden] { display: block; }
#nav.no-sales .nav-sub a { padding-left: 10px; font-weight: 500; font-size: 14px; }
#nav a[hidden] { display: none; }
/* Filter buttons and their searchable picker */
.filter-pick { padding: 5px 10px; font-size: 13px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-pick.active { border-color: var(--text); font-weight: 600; }
.filter-pop { position: absolute; z-index: 1200; width: 300px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px rgba(15,15,15,0.16); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.filter-pop-search { width: 100%; }
.filter-pop-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; }
.filter-pop-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 4px; font-size: 13px; line-height: 1.3; cursor: pointer; text-align: left; }
/* The global text-box style (full width, padding, border) mustn't apply to these checkboxes. */
.filter-pop-item input[type="checkbox"] { flex: 0 0 auto; width: 15px; height: 15px; margin: 0; padding: 0; border: none; box-shadow: none; accent-color: var(--text); cursor: pointer; }
.filter-pop-item span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.filter-pop-item:hover { background: #f1f1ef; }
.filter-add { border-style: dashed; color: var(--muted); }
.filter-pop-col { border: none; background: none; width: 100%; font: inherit; }
.filter-pop-empty { padding: 8px 6px; font-size: 13px; }
.filter-pop-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.filter-pop-count { flex: 1; font-size: 12px; }
#providers-map { height: min(620px, calc(100vh - 260px)); min-height: 360px; border: 1px solid var(--border); border-radius: 8px; background: var(--sidebar); z-index: 0; }
#providers-map .leaflet-tile-pane { filter: grayscale(1) contrast(1.05); }
/* Unity leads */
.lead-strip { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; padding-bottom: 2px; }
.lead-stage { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 110px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: #fff; text-align: left; }
.lead-stage .label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.lead-stage .num { font-size: 16px; font-weight: 600; }
.lead-stage.off-board { border-style: dashed; background: #fafaf9; }
.lead-stage.selected { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.lead-note { margin-top: 6px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-more { width: 100%; font-size: 12px; padding: 5px 8px; }
.board.is-loading { opacity: 0.55; }
.pager { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-left: auto; }
.pager button { padding: 4px 10px; font-size: 13px; }
.pager button:disabled { opacity: 0.4; cursor: default; }
.page-jump { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.page-input { width: 64px; padding: 3px 6px; font-size: 13px; text-align: center; }
.page-input::-webkit-inner-spin-button { opacity: 0.5; }
.toolbar.bottom { margin-top: 12px; }
.table-wrap.is-loading { opacity: 0.55; transition: opacity 0.15s; }
/* Locked record (profile view): fields read like text until Edit is clicked. */
#record-form.locked #form-fields :is(input, select, textarea):disabled {
  background: transparent; border-color: transparent; padding-left: 0; color: var(--text);
  -webkit-text-fill-color: var(--text); opacity: 1; appearance: none; resize: none;
}
#record-form.locked #form-fields label { color: var(--muted); }
/* Profile sections: each gets its own accent color (heading, left edge and a light tint). */
.accent-blue { --accent: #2f6fdb; }
.accent-purple { --accent: #7c5cd6; }
.accent-green { --accent: #2e8b57; }
.accent-orange { --accent: #d9822b; }
.accent-teal { --accent: #148f8f; }
.accent-pink { --accent: #c2477a; }
.accent-slate { --accent: #4f6d8a; }
.accent-gray { --accent: #787774; }
#form-fields.sectioned { display: flex; flex-direction: column; gap: 12px; }
.form-block {
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 5%, #fff);
  padding: 12px 14px 14px;
}
.form-block .form-grid { margin: 0; }
.form-section { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--accent, var(--text)); letter-spacing: 0.01em; }
.form-section::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent, var(--text)); flex-shrink: 0; }
.form-section .muted { font-weight: 400; color: var(--muted); }
.form-block label { color: color-mix(in srgb, var(--accent) 55%, var(--muted)); }
#record-form.locked .form-block label { color: color-mix(in srgb, var(--accent) 55%, var(--muted)); }
.group-section { margin-bottom: 12px; }
.group-section .group-shared { margin-bottom: 0; }
.group-section .pc-label { color: color-mix(in srgb, var(--accent) 60%, var(--muted)); }
.group-more { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; }
.group-more:empty { display: none; }
#group-dialog { width: min(980px, 96vw); }
.group-card { padding: 0 28px 24px; }
.group-shared { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 18px; margin-bottom: 18px; }
.group-shared .pc-field { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.group-loc-title { margin: 4px 0 10px; font-size: 15px; }
.group-loc-title .muted { font-weight: 400; font-size: 13px; }
#group-body tr[data-loc] { cursor: pointer; }
.loc-count { display: inline-block; min-width: 22px; padding: 1px 8px; border-radius: 999px; background: #f1f1ef; font-weight: 600; text-align: center; }
.history { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 14px; }
.history h3 { margin: 0 0 10px; font-size: 14px; }
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.history-who { font-size: 13px; }
.history-what { font-size: 13px; line-height: 1.5; margin-top: 2px; }
.history-what .was { color: var(--muted); text-decoration: line-through; }
table.activity td { vertical-align: top; }
.nowrap { white-space: nowrap; }
.view-only-tag { font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; }

/* Sales arrow sits in the icon slot and only appears on hover, so Sales lines up with the other tabs */
.nav-icon { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; flex-shrink: 0; }
.nav-icon .nav-caret { position: absolute; inset: 0; margin: 0; width: 16px; height: 16px; display: none; color: var(--muted); }
.nav-parent:hover .nav-icon svg { visibility: hidden; }
.nav-parent:hover .nav-icon .nav-caret { display: grid; }
