/* ==========================================================================
   Shared saved-list styling.  The Delete UX + the pagination control below
   are shared by ui/static (Saved Workstreams) and console/static (Saved
   Coordinators); the table styling itself is in the "Saved-list TABLE"
   section near the bottom of this file.
   ==========================================================================
   Delete UX — section-level "Delete" toggle, per-row checkboxes, bottom
   toolbar, and confirmation modal.  Moved out of ui/static/style.css when
   the console grew the same multi-select delete on Saved Coordinators.
   ========================================================================== */

.ws-delete-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-dim);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
}
.ws-delete-btn:hover {
  color: var(--red);
  border-color: var(--red);
}

.ws-card-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  accent-color: var(--red);
  cursor: pointer;
  z-index: 1;
  opacity: 0;
  animation: ws-check-fadein 0.2s ease-out forwards;
}
.ws-card-check:focus-visible {
  /* Card click-handler proxies space/enter to the checkbox, so focus
     usually rests on the card; if a screen reader / power user tabs
     directly onto the checkbox the UA outline can be killed by
     adjacent rules — this guarantees a visible affordance. */
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@keyframes ws-check-fadein {
  to {
    opacity: 1;
  }
}
.ws-delete-bar {
  display: none;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ws-delete-bar.visible {
  display: flex;
  animation: ws-bar-slide 0.2s ease-out;
}
@keyframes ws-bar-slide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ws-card-check {
    animation: none;
    opacity: 1;
  }
  .ws-delete-bar.visible {
    animation: none;
  }
  .pagination button {
    transition: none;
  }
}
/* Below ~700px the four-pill bar's preferred width (~480-520px) starts
   eating into hit-targets and risking horizontal overflow.  Wrap onto
   two rows: count + Cancel + Select All on the first, the destructive
   Delete Selected on its own full-width row underneath — also a better
   thumb-target separation than the desktop layout. */
@media (max-width: 700px) {
  .ws-delete-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .ws-delete-bar .ws-delete-bar-btn {
    margin-left: 0;
    flex: 1 1 100%;
    order: 99;
  }
}
.ws-delete-bar .ws-delete-count-label {
  font-size: 12px;
  color: var(--fg-dim);
}
.ws-delete-bar .ws-delete-bar-btn {
  margin-left: auto;
  /* Dark-theme --red (#f87171) on #fff is only 3.0:1 — below WCAG AA
     for normal text on a destructive button.  Use the deeper red
     (#dc2626 → 4.85:1) on the filled state so the button label clears
     AA in the default theme. Light theme already uses --red (#b91c1c,
     5.9:1) and stays put — the override below pins it. */
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}
[data-theme="light"] .ws-delete-bar .ws-delete-bar-btn {
  background: var(--red);
}
.ws-delete-bar .ws-delete-bar-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}
.ws-delete-bar .ws-delete-bar-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ws-delete-bar .ws-delete-cancel-btn {
  background: transparent;
  color: var(--fg-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}
.ws-delete-bar .ws-delete-cancel-btn:hover {
  color: var(--fg-bright);
  border-color: var(--border-strong);
  background: var(--bg-highlight);
}
.ws-delete-bar .ws-delete-selectall-btn {
  background: transparent;
  color: var(--fg-bright);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.ws-delete-bar .ws-delete-selectall-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-highlight);
}

/* Batch-delete confirm list — rendered by cards.js inside the
   #ws-delete-dialog / #coord-delete-dialog hatch dialogs.  The dialog
   chrome, alert strip and scroll region are hatch.css's (the sh-body is
   the only scroll region); only the row treatment lives here. */
.ws-delete-item {
  padding: 6px 0;
  font-size: 13px;
  color: var(--fg-bright);
  border-bottom: 1px solid var(--border);
  /* Long aliases / raw ws_ids in the confirm + results list shouldn't
     punch out of the dialog at narrow viewports. */
  word-break: break-word;
}
.ws-delete-item:last-child {
  border-bottom: none;
}
.ws-delete-item.ws-delete-error {
  color: var(--red);
}

/* ==========================================================================
   Pagination — shared by the console's filtered admin lists and the saved
   workstream / coordinator tables (createSavedTable fills the container with
   Prev / “page X / Y” / Next, 20 rows per page).  Lives in /shared so the
   surfaces that use it can't drift apart.
   ========================================================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0;
  font-size: 12px;
  color: var(--fg-dim);
}
.pagination button {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--fg-bright);
  border-radius: var(--radius-sm);
  padding: 5px 14px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
  font-family: var(--font-ui);
  font-weight: 500;
}
.pagination button:hover {
  background: var(--bg-highlight);
  border-color: var(--accent-dim);
}
.pagination button:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* ==========================================================================
   Saved-list TABLE — reuses base.css .dash-header / .dash-colheaders /
   .dash-row / .dash-row-main (visual parity with the active dashboard
   table above it).  These add the saved-specific cells, skill chip, header
   sort affordance, filter toolbar, footer, and delete-mode on rows.  Shared
   by ui/static (Saved Workstreams) and console/static (Saved Coordinators).
   ========================================================================== */

.saved-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.saved-filter {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font: inherit;
  font-size: 11px;
  padding: 4px 10px;
  width: 200px;
}
.saved-filter::placeholder {
  color: var(--fg-dim);
  opacity: 0.7;
}
.saved-filter:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

/* Sortable column headers — saved table only (active uses .dash-col). */
.dash-colheaders .scol {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  user-select: none;
}
.dash-colheaders .scol.scell-r {
  justify-content: flex-end;
}
.dash-colheaders .scol:hover {
  color: var(--fg);
}
.dash-colheaders .scol.sorted {
  color: var(--accent);
}
.dash-colheaders .scol .caret {
  font-size: 8px;
}
/* Inactive columns show a faint neutral caret so every header reads as
   sortable at rest (not just on hover / the active column). */
.dash-colheaders .scol .caret.caret-idle {
  opacity: 0.35;
}

/* Row cells.  Saved rows reuse the dash-table chrome but are a terminal,
   mostly-idle, long list — so the styling that the active (live, short)
   table tunes for is overridden deliberately here, in one place, rather
   than fought property-by-property: a legible zebra (the active table's
   near-zero --row-alt vanishes on a long list) and full-opacity muted text
   (AA-legible colours, no opacity hacks).  Idle-dimming is avoided at the
   source — renderSessionRow only sets data-state for `error`. */
/* Saved rows are always interactive — resume on click, or toggle a checkbox
   in delete mode — so they own the pointer cursor here rather than relying on
   each app's `.dash-row` convention.  The server sets `cursor: pointer` on
   every `.dash-row`; the console scopes it to `.dash-row.has-link` (a class
   the shared row builder doesn't set), so without this the console's saved
   rows fell back to the base `cursor: default`. */
.saved-row {
  cursor: pointer;
}
.saved-row .dash-row-main {
  padding: 8px 16px;
  /* one CSS var, set per render by createSavedTable (responsive-aware) */
  grid-template-columns: var(--saved-grid);
}
.saved-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.025);
}
[data-theme="light"] .saved-row:nth-child(even) {
  background: rgba(0, 0, 0, 0.03);
}
.scell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.scell-r {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--fg-dim);
  font-size: 11px;
}
.scell-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 500;
  color: var(--fg-bright);
}
.scell-name .scell-nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.scell-model {
  color: var(--fg-dim);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.scell-id {
  /* --fg-dim alone clears WCAG AA in both themes; the prior opacity:0.5
     dragged it to ~2.4:1 — and ID is the near-duplicate-name disambiguator,
     so it has to stay legible. */
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}
/* CTX here is a frozen snapshot at last activity, not the live gauge the
   active table shows — lighter weight so it doesn't read as the same
   instrument (the column header carries a "context at last activity"
   tooltip). */
.saved-row .dash-cell-ctx {
  font-weight: 400;
}

/* Skill chip — cool-slate lane, distinct from the amber accent + CTX
   colours; glyph + >=0.15 tint keeps it legible at chip size. */
.skill-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #aeb8db;
  background: rgba(120, 140, 210, 0.16);
  border: 1px solid rgba(120, 140, 210, 0.34);
  border-radius: 10px;
  padding: 1px 7px 1px 6px;
}
.skill-chip-g {
  font-size: 8px;
  opacity: 0.85;
}
[data-theme="light"] .skill-chip {
  color: #44507a;
  background: rgba(90, 110, 180, 0.14);
  border-color: rgba(90, 110, 180, 0.4);
}

/* Footer count line — mirrors the active table's footer altitude. */
.saved-footer {
  padding: 9px 16px;
  font-size: 11px;
  color: var(--fg-dim);
}

/* Footer + pager share one justified row: the dim range readout anchors the
   left edge, the Prev/Next control docks to the right gutter on the same
   baseline, so the count and the navigation that moves it read as one region
   instead of a left-aligned count floating above a centred pager.  Scoped to
   the saved table — the standalone `.pagination` the console's filtered admin
   lists use keeps its own centred block layout. */
.saved-pager-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.saved-pager-row .pagination {
  padding: 6px 16px;
}
@media (max-width: 760px) {
  .saved-pager-row {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .saved-pager-row .pagination {
    justify-content: center;
  }
}

/* Delete mode on rows: the shared controller inserts an absolute checkbox
   (positioned top-right for cards); reposition to the row's left edge and
   shift the grid so it doesn't collide with NAME. */
.dash-row .ws-card-check {
  top: 50%;
  left: 10px;
  right: auto;
  transform: translateY(-50%);
}
.dash-row.ws-delete-mode .dash-row-main {
  padding-left: 34px;
}
/* Keep the column headers registered with the rows while multi-selecting:
   rows reserve a 34px checkbox gutter, so the headers shift to match. */
.dash-colheaders.saved-cols-delete {
  padding-left: 34px;
}
.dash-row.ws-selected {
  background: rgba(248, 113, 113, 0.08);
}
[data-theme="light"] .dash-row.ws-selected {
  background: rgba(220, 38, 38, 0.08);
}
