/* shared-app/table.css — styling for shared-app/table.js's table,
   row-menu and searchable-select factories. TOKENS ONLY (see
   shared-app/frame.css's own header for the "one token authority"
   contract this sheet keeps too) - dense rows (~36px), a sticky header,
   a hairline under the header row only (round 5's unboxing doctrine:
   "one rule under the header row, none between rows" -
   docs/design/UI-ROUND4-PLAN.md, R4-B), and min-width per column so a
   cell never truncates to one character. */

.sf-table-wrap { display: flex; flex-direction: column; gap: var(--s2); }
.sf-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
}
.sf-table-search, .sf-table-facet {
  min-height: 36px;
  padding: 6px 10px;
  font: 13px var(--mono);
  border: 1px solid var(--line);
  border-radius: var(--r-touch);
  background: var(--card);
  color: var(--ink);
}
.sf-table-search { flex: 1 1 220px; max-width: 340px; }
.sf-table-facet { flex: 0 1 200px; }
.sf-table-search:focus, .sf-table-facet:focus { border-color: var(--blue); }

.sf-table-scroll { overflow-x: auto; }
.sf-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sf-col { min-width: 0; }
.sf-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card);
}
.sf-th {
  text-align: left;
  padding: 6px 12px 6px 0;
  border-bottom: 1px solid var(--line);
  font: 600 9.5px var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.sf-th:first-child { padding-left: 0; }
.sf-th-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.sf-th-btn:hover { color: var(--muted); }
.sf-th-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Dense rows (~36px target height): compact vertical padding, one rule
   under the header only - no per-row border. A hover tint carries the
   row boundary instead, the same devices R4-B names in place of boxes. */
.sf-row { border-bottom: 1px solid var(--soft); }
.sf-row:last-child { border-bottom: none; }
.sf-row:hover { background: var(--surface2); }
.sf-row:focus { outline: none; background: var(--surface2); }
.sf-row:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}
.sf-td {
  padding: 8px 12px 8px 0;
  vertical-align: middle;
  color: var(--ink);
}
.sf-td:first-child { padding-left: 0; }
.sf-td-empty { color: var(--muted); padding: 16px 0; text-align: center; }

.sf-td-actions, .sf-th-actions { text-align: right; white-space: nowrap; }
.sf-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: relative;
}
.sf-row-actions .btn { min-height: 26px; padding: 2px 8px; font-size: 9.5px; }
.sf-row-menu {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 20;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-touch);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.sf-row-menu-item {
  text-align: left;
  background: none;
  border: none;
  padding: 7px 10px;
  font: 12px var(--sans);
  color: var(--ink);
  cursor: pointer;
  border-radius: var(--r-touch);
}
.sf-row-menu-item:hover, .sf-row-menu-item:focus-visible {
  background: var(--soft);
  outline: none;
}
.sf-row-menu-item-danger { color: var(--bad); }

.sf-table-pager {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font: 12px var(--mono);
  color: var(--muted);
}
.sf-table-pager-count { font-variant-numeric: tabular-nums; }
.sf-table-pager .btn { min-height: 30px; padding: 2px 10px; }
.sf-table-pager .btn:disabled { opacity: 0.5; cursor: default; }

/* ---- searchable select (office/person type-ahead) ------------------- */
.sf-searchselect { position: relative; display: inline-block; min-width: 220px; }
.sf-searchselect-input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  font: 13px var(--mono);
  border: 1px solid var(--line);
  border-radius: var(--r-touch);
  background: var(--card);
  color: var(--ink);
}
.sf-searchselect-input:focus { border-color: var(--blue); }
.sf-searchselect-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 30;
  margin: 2px 0 0;
  padding: 4px;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-touch);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}
.sf-searchselect-item {
  padding: 7px 10px;
  font: 13px var(--sans);
  color: var(--ink);
  cursor: pointer;
  border-radius: var(--r-touch);
}
.sf-searchselect-item:hover,
.sf-searchselect-item[aria-selected="true"] { background: var(--soft); }

/* ---- multi-select (office-scope-style pickers) ----------------------- */
.sf-multiselect { display: flex; flex-direction: column; gap: 6px; max-width: 420px; }
.sf-multiselect-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sf-multiselect-chips:empty { display: none; }
.sf-multiselect-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 10px;
  font: 12px var(--sans);
  color: var(--ink);
  background: var(--soft);
  border-radius: var(--r-touch);
}
.sf-multiselect-chip-remove {
  background: none;
  border: none;
  padding: 2px 4px;
  font: 13px var(--sans);
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.sf-multiselect-chip-remove:hover { color: var(--ink); }
.sf-multiselect-chip-remove:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

@media (max-width: 767px) {
  .sf-table-search { max-width: none; flex-basis: 100%; }
}
