/* Rob reference pass: compact, live-edit Lead/Task Tracker */
.tracker-command-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: start;
  gap: 10px;
  margin: 10px 0 12px;
}

.tracker-command-bar > #queueSearch {
  min-height: 38px;
  margin: 0;
}

.tracker-filter-disclosure {
  position: relative;
  z-index: 8;
}

.tracker-filter-disclosure > summary {
  min-width: 88px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line, #ddd3cc);
  border-radius: 9px;
  background: #fffdfb;
  color: var(--ink, #35283a);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  list-style: none;
}

.tracker-filter-disclosure > summary::-webkit-details-marker { display: none; }
.tracker-filter-disclosure > summary::after { content: "▾"; margin-left: 8px; font-size: 10px; }
.tracker-filter-disclosure[open] > summary { border-color: #d7a38d; box-shadow: 0 0 0 3px rgba(215, 103, 68, .1); }

.tracker-filter-disclosure .lead-filter-bar {
  position: absolute;
  top: 44px;
  right: 0;
  width: min(720px, calc(100vw - 320px));
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 8px;
  padding: 12px;
  margin: 0;
  border: 1px solid #e5d8d0;
  border-radius: 12px;
  background: #fffdfb;
  box-shadow: 0 16px 36px rgba(65, 41, 56, .16);
}

.tracker-filter-disclosure .lead-filter-bar select { min-height: 36px; }
.tracker-filter-disclosure .lead-filter-bar #leadSort { grid-column: 1 / -1; }

#queueTable { display: grid; gap: 10px; }
.lead-status-group {
  margin: 0;
  overflow: hidden;
  border: 1px solid #e7ddd7;
  border-radius: 9px;
  background: #fffdfb;
  box-shadow: none;
}

.lead-group-header {
  min-height: 36px;
  padding: 6px 10px;
  border-bottom: 1px solid #eee5df;
  background: #fcf9f6;
}

.lead-group-header > div { gap: 7px; }
.lead-group-header h3 { font-size: 12px; font-weight: 800; letter-spacing: .01em; }
.lead-group-header small { display: none; }
.lead-count { min-width: 20px; height: 20px; padding: 0 6px; font-size: 10px; }
.lead-status-dot { width: 7px; height: 7px; }

.lead-table-wrap { max-height: none; border: 0; border-radius: 0; }
.lead-table {
  min-width: 1480px;
  table-layout: fixed;
  border-collapse: collapse;
}

.lead-table th {
  height: 30px;
  padding: 5px 7px;
  background: #fffaf7;
  color: #796b75;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .055em;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
}

.lead-table tbody > tr.lead-task-row > td,
.lead-table tbody > tr.inline-task-row > td {
  height: 38px;
  min-height: 38px;
  padding: 3px 6px;
  border-top: 1px solid #f0e9e4;
  background: #fffdfb;
  color: #493a49;
  font-size: 11.5px;
  line-height: 1.2;
  vertical-align: middle;
}

.lead-task-row:hover > td { background: #fff9f5; }
.lead-task-row.is-inline-editing:focus-within > td {
  background: #fff8f3;
  box-shadow: inset 0 1px #e9c4b2, inset 0 -1px #e9c4b2;
}
.lead-task-row.is-saving { opacity: 1; }

.lead-date-cell { width: 112px; min-width: 112px; white-space: nowrap; }
.lead-date-cell strong { font-size: 11px; font-weight: 650; }
.lead-name-cell { position: relative; width: 242px; min-width: 242px; padding-right: 80px !important; }
.lead-comments-cell { width: 205px; min-width: 205px; }
.lead-text-cell { width: 190px; min-width: 190px; }
.lead-phone { width: 132px; min-width: 132px; }
.lead-email { width: 185px; min-width: 185px; }
.lead-date-done-cell { width: 128px; min-width: 128px; }

.lead-name-primary {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
}

.lead-name-button,
.lead-name-primary > .lead-inline-input {
  min-width: 0;
  color: #35283a;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.15;
}

.lead-name-button { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-row-meta { display: none; }

.lead-inline-input,
.lead-table .inline-lead-select {
  width: 100%;
  min-width: 90px;
  min-height: 28px;
  height: 28px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #493a49;
  font: inherit;
  font-size: 11.5px;
  line-height: 1.15;
  box-shadow: none;
}

.lead-inline-input:is(select),
.lead-table .inline-lead-select { padding-right: 22px; cursor: pointer; }
.lead-inline-input:hover,
.lead-table .inline-lead-select:hover { border-color: #e5d6cd; background: #fff; }
.lead-inline-input:focus,
.lead-table .inline-lead-select:focus {
  outline: none;
  border-color: #d76744;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(215, 103, 68, .11);
}

.lead-move-control {
  position: absolute;
  top: 5px;
  right: 6px;
  display: block;
  width: 70px;
  margin: 0;
  opacity: .42;
  transition: opacity .14s ease;
}
.lead-name-cell:hover .lead-move-control,
.lead-move-control:focus-within { opacity: 1; }
.lead-move-control > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.lead-move-control .inline-lead-select { min-width: 70px; height: 28px; font-size: 9px; font-weight: 750; }

.row-save-state {
  flex: 0 0 auto;
  color: #9b8f96;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .035em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity .14s ease;
}
.row-save-state.state-dirty,
.row-save-state.state-saving,
.row-save-state.state-error { opacity: 1; }
.row-save-state.state-saving { color: #b45a3d; }
.row-save-state.state-error { color: #a63e3e; }

.lead-date-done-editor { display: block; }
.lead-date-done-editor small { display: none; }

.row-comment-trigger {
  min-height: 28px;
  padding: 2px 4px;
  gap: 6px;
  border-radius: 6px;
}
.row-comment-trigger img { width: 14px; height: 14px; opacity: .74; }
.row-comment-summary { min-width: 0; gap: 1px; }
.row-comment-summary strong { font-size: 10.5px; }
.row-comment-summary span { overflow: hidden; color: #877983; font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }

.row-comment-inline-panel { padding: 12px 18px 14px; background: #fffaf6; }
.row-comment-thread-scroll { max-height: 260px; }

.add-task-row {
  width: 100%;
  min-height: 30px;
  padding: 5px 12px;
  border: 0;
  border-top: 1px solid #f0e9e4;
  border-radius: 0;
  background: #fffdfb;
  color: #7b6c75;
  font-size: 10.5px;
  font-weight: 700;
  text-align: left;
}
.add-task-row:hover { background: #fff6f0; color: #c45737; }

.inline-task-actions { display: flex; align-items: center; gap: 4px; }
.inline-task-actions button { min-height: 26px; padding: 3px 7px; font-size: 9px; }
.inline-task-feedback { display: none; }

@media (max-width: 900px) {
  .tracker-command-bar { grid-template-columns: minmax(0, 1fr) auto; }
  .tracker-filter-disclosure .lead-filter-bar { width: min(520px, calc(100vw - 40px)); }
  .lead-table { min-width: 1380px; }
}

@media (max-width: 600px) {
  .tracker-filter-disclosure .lead-filter-bar { grid-template-columns: 1fr; }
  .tracker-filter-disclosure .lead-filter-bar #leadSort { grid-column: auto; }
}

/* Visual QA corrections: preserve task-name priority and readable headers. */
.lead-table { table-layout: auto; }

.lead-table th,
.lead-table td { white-space: nowrap; }

.lead-name-primary > .lead-inline-input {
  flex: 1 1 160px;
  width: auto;
  min-width: 150px;
  color: #35283a;
}

.lead-move-control {
  opacity: 0;
  pointer-events: none;
}

.lead-name-cell:hover .lead-move-control,
.lead-move-control:focus-within {
  opacity: 1;
  pointer-events: auto;
}

.lead-table th:nth-child(1) { min-width: 112px; }
.lead-table th:nth-child(2) { min-width: 242px; }
.lead-table th:nth-child(3) { min-width: 205px; }

@media (hover: none) {
  .lead-move-control { opacity: .55; pointer-events: auto; }
}

/* Reference order: name, date, comments, contact, concern, email, source, assignee, clinic. */
.lead-table th:nth-child(1) { min-width: 242px; }
.lead-table th:nth-child(2) { min-width: 112px; }
.lead-table th:nth-child(3) { min-width: 205px; }
.lead-table th:nth-child(4) { min-width: 132px; }
.lead-table th:nth-child(5) { min-width: 190px; }
.lead-table th:nth-child(6) { min-width: 185px; }

/* Keep comments on one line so task rows stay at the reference density. */
.row-comment-summary {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
}
.row-comment-summary strong { flex: 0 0 auto; }
.row-comment-summary span { min-width: 0; max-width: 108px; }

/* Override legacy 54px row rules without changing non-tracker tables. */
.lead-table tbody > tr.lead-task-row > td,
.lead-table tbody > tr.inline-task-row > td {
  height: 38px !important;
  min-height: 38px !important;
  padding: 3px 6px !important;
}
.lead-comments-cell .row-comment-trigger {
  min-height: 28px !important;
  padding: 2px 4px !important;
}
