:root {
  --bg: #ffffff;
  --primary: #2d8e7e;
  --primary-dark: #1f6c5f;
  --primary-light: #e6f4f1;
  --primary-lighter: #f3faf8;
  --accent: #c2cd05;
  --accent-dark: #98a104;
  --accent-light: #fbfde0;
  --text: #0a0a0a;
  --text-muted: #5f6b69;
  --border: #e1e7e5;
  --border-strong: #c9d3d1;
  --radius: 6px;
  --row-height: 35px;
  --name-col-width: 190px;
  --role-col-width: 110px;
  --loc-col-width: 168px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;
}

/* Always reserve space for the vertical scrollbar so it doesn't pop in/out
   (and shift all content sideways) as filtering changes the list height. */
html { scrollbar-gutter: stable; }

/* Header / filter bar (combined: filter controls on the primary-colored band) */
.filterbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  box-shadow: 0 2px 6px rgba(10,10,10,0.06);
}

.filter-group { position: relative; }

/* Widths mirror the list columns beneath so each filter sits above its column */
#searchInput { width: var(--name-col-width); }
.combo-input { width: 190px; padding-right: 30px; }
.combo-input-role { width: var(--role-col-width); padding-right: 22px; }
.combo-input-location { width: var(--loc-col-width); }
#roleComboWrap .count-badge { right: 5px; }

input[type="text"] {
  font-size: 13px;
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  outline: none;
}
input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.count-badge {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  color: #333d00;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 6px;
  min-width: 14px;
  text-align: center;
  pointer-events: none;
}

/* Combobox dropdown panel */
.combo-panel {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  width: 300px;
  max-height: 380px;
  overflow-y: auto;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(10,10,10,0.14);
  z-index: 40;
}
.combo-panel[hidden] { display: none; }

.combo-clear-row {
  display: flex;
  justify-content: flex-end;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}
/* Kept in the DOM at all times (space reserved) so selecting the first
   option doesn't shift every option below it down by a row. */
.combo-clear-row.is-empty { visibility: hidden; }
.combo-clear-btn {
  background: none;
  border: none;
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}
.combo-clear-btn:hover { text-decoration: underline; color: var(--accent-dark); }

.combo-group-title {
  position: sticky;
  top: 0;
  background: var(--primary-lighter);
  color: var(--primary-dark);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 4px 10px;
  z-index: 1;
}
.combo-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12.5px;
}
.combo-option:hover, .combo-option.highlighted { background: var(--primary-lighter); }
.combo-option input { margin: 0; accent-color: var(--primary); flex: 0 0 auto; }
.combo-option .opt-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combo-option .opt-count { color: var(--text-muted); font-size: 11px; }
.combo-option.combo-category {
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-lighter);
  border-bottom: 1px solid var(--border);
}
.combo-option.combo-category:hover { background: var(--primary-light); }
.combo-option .color-dot {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  border: 1px solid rgba(10,10,10,0.2);
}
.combo-empty {
  padding: 8px 10px;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}
.link-btn:hover { text-decoration: underline; }

.clear-all-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.45);
  color: rgba(255,255,255,0.9);
  font-size: 12px;
  border-radius: var(--radius);
  padding: 6px 10px;
  cursor: pointer;
}
.clear-all-btn:hover { border-color: var(--accent); color: #fff; }
/* Reserve its slot even when inactive so the chips/count next to it don't
   shift horizontally when filters are applied/cleared. */
.clear-all-btn.is-invisible { visibility: hidden; }

/* Active filter chips (inline in the filterbar) */
.active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  color: #4a5100;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 5px 2px 9px;
}
.chip .chip-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  border: 1px solid rgba(10,10,10,0.2);
}
.chip button {
  background: var(--accent-dark);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-count {
  margin-left: auto;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
}

/* Therapist list: fixed 35px rows, horizontal scroll */
.list-scroll {
  overflow-x: auto;
}
.therapist-list {
  display: flex;
  flex-direction: column;
  min-width: max-content;
}

.t-card {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--row-height);
  min-width: max-content;
  border: 1px solid var(--border);
  border-top: none;
  background: #fff;
  padding: 0 10px 0 0;
}
.t-card:hover, .t-card:hover .t-frozen { background: var(--primary-light); }

/* Name, role and locations are wrapped in one sticky block so they move together as a
   single rigid unit while scrolling — separately-sticky columns would each "snap" into
   place at a different scroll offset, breaking alignment with the filters above. */
.t-frozen {
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  /* Explicit width, not shrink-to-fit: Firefox miscomputes the intrinsic
     size of a `position: sticky` flex item (auto width collapses and lets
     the name/role/location columns overlap the specialities that follow),
     while Chromium/WebKit size it correctly from its children. */
  flex: 0 0 auto;
  width: calc(var(--name-col-width) + var(--role-col-width) + var(--loc-col-width) + 12px);
  height: 100%;
  background: #fff;
}

.t-name-col {
  display: flex;
  align-items: center;
  flex: 0 0 var(--name-col-width);
  height: 100%;
  border-right: 1px solid var(--border);
  padding: 0 10px;
}
.t-role-col {
  display: flex;
  align-items: center;
  flex: 0 0 var(--role-col-width);
  height: 100%;
  border-right: 1px solid var(--border);
  padding: 0 10px;
}
.t-name {
  font-weight: 700;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.t-role {
  font-size: 10.5px;
  color: var(--primary-dark);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  width: 100%;
}

.t-locations {
  flex: 0 0 var(--loc-col-width);
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  border-right: 1px solid var(--border);
  padding-right: 6px;
}

.loc-tag {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 4px;
  padding: 3px 7px;
  white-space: nowrap;
  cursor: help;
}
.loc-tag.dim { opacity: 0.35; }

.remark-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 11px;
  color: #8a6d00;
  background: #fdf6dd;
  border: 1px solid #ecd98a;
  border-radius: 50%;
  cursor: help;
}

.spec-chip {
  flex: 0 0 auto;
  font-size: 10.5px;
  background: #f2f4f3;
  color: var(--text);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

.spec-chip:hover {
  cursor: default;
}

.spec-chip.match {
  background: var(--accent-light);
  border-color: var(--accent-dark);
  color: #4a5100;
  font-weight: 700;
}
.spec-chip .exp { opacity: 0.65; font-weight: 400; }
.no-spec { color: var(--text-muted); font-size: 11px; font-style: italic; white-space: nowrap; }

/* Empty / error state */
.empty-state, .error-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state p, .error-state p { margin: 0 0 8px 0; font-size: 14px; }

/* Authentication wall */
.auth-wall {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  padding: 20px;
}
.auth-wall[hidden] { display: none; }
.login-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px 26px;
  width: 100%;
  max-width: 300px;
  box-shadow: 0 10px 28px rgba(10,10,10,0.14);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 {
  font-size: 16px;
  margin: 0;
  color: var(--text);
}
.login-sub {
  margin: -6px 0 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.login-card input[type="password"] {
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  outline: none;
}
.login-card input[type="password"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.remember-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
}
.remember-row input { accent-color: var(--primary); }
.login-card button[type="submit"] {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.login-card button[type="submit"]:hover { background: var(--primary-dark); }
.login-error {
  margin: 0;
  font-size: 12px;
  color: #b3261e;
}
.login-error[hidden] { display: none; }

.logout-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.45);
  color: rgba(255,255,255,0.9);
  font-size: 12px;
  border-radius: var(--radius);
  padding: 6px 10px;
  cursor: pointer;
}
.logout-btn:hover { border-color: var(--accent); color: #fff; }
