/* jobs.css — admin view at /jobs.html
 *
 * Inherits .app, .brandbar, .clock, .action-btn from styles.css. This
 * file adds table-specific styling: status badges, expandable cells,
 * filter panel layout.
 */

.jobs-page {
  padding: 1.25rem 1.5rem 4rem;
  max-width: 1600px;
  margin: 0 auto;
}

.jobs-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.jobs-header h1 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.8rem;
  margin: 0 0 0.25rem;
}
.jobs-header .muted {
  color: var(--ink-soft, #687180);
  margin: 0;
  max-width: 60ch;
  font-size: 0.9rem;
}
.jobs-actions { display: flex; gap: 0.5rem; }

.jobs-stats {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.stat-chip {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 0.85rem;
  background: var(--surface, #f8f9fb);
  border-radius: 6px;
  border: 1px solid var(--ink-faint, #e1e5ec);
  min-width: 96px;
}
.stat-chip .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1;
}
.stat-chip .lbl {
  font-size: 0.72rem;
  color: var(--ink-soft, #687180);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.2rem;
}
.stat-chip.pending      .num { color: #6b7280; }
.stat-chip.in-progress  .num { color: #0a6cdf; }
.stat-chip.done         .num { color: #197447; }
.stat-chip.failed       .num { color: #c5350a; }

.jobs-filters {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: var(--surface, #f8f9fb);
  border: 1px solid var(--ink-faint, #e1e5ec);
  border-radius: 6px;
  margin-bottom: 0.85rem;
}
.jobs-filters fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.jobs-filters legend {
  font-size: 0.75rem;
  color: var(--ink-soft, #687180);
  margin-right: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.jobs-filters label {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}
.jobs-filters input[type="search"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--ink-faint, #e1e5ec);
  border-radius: 4px;
  min-width: 220px;
  font-family: 'Inter Tight', system-ui, sans-serif;
}
.jobs-filters select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--ink-faint, #e1e5ec);
  border-radius: 4px;
  background: white;
}

.jobs-table-wrap {
  overflow-x: auto;
  background: white;
  border: 1px solid var(--ink-faint, #e1e5ec);
  border-radius: 6px;
}
table#jobs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table#jobs-table th {
  text-align: left;
  padding: 0.5rem 0.6rem;
  background: var(--surface, #f8f9fb);
  border-bottom: 1px solid var(--ink-faint, #e1e5ec);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft, #687180);
  cursor: default;
  user-select: none;
  white-space: nowrap;
}
table#jobs-table th[data-sort] {
  cursor: pointer;
}
table#jobs-table th[data-sort]:hover {
  color: var(--ink, #1a1f2c);
}
table#jobs-table th[data-sort].sort-asc::after  { content: ' ↑'; }
table#jobs-table th[data-sort].sort-desc::after { content: ' ↓'; }
table#jobs-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--ink-faint, #f0f2f6);
  vertical-align: top;
  max-width: 280px;
}
table#jobs-table tbody tr:hover { background: #fcfdff; }
table#jobs-table tbody tr.clickable { cursor: pointer; }
table#jobs-table td.empty {
  text-align: center;
  padding: 2rem;
  color: var(--ink-soft, #687180);
}

.j-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  white-space: nowrap;
}
.j-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  white-space: nowrap;
}
.j-truncate {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  max-width: 280px;
}

.j-status {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.j-status.pending      { background: #f0f1f4; color: #4b5563; }
.j-status.in-progress  { background: #e3effc; color: #0a6cdf; }
.j-status.done         { background: #e1f3e9; color: #197447; }
.j-status.failed       { background: #fbe7e0; color: #c5350a; }

.j-sbr { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }
.j-worker { font-family: 'JetBrains Mono', monospace; font-size: 0.74rem; color: var(--ink-soft, #687180); white-space: nowrap; }

.j-error {
  color: #c5350a;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  max-width: 240px;
  word-break: break-word;
}

/* ---------- detail dialog ---------- */
dialog#job-detail {
  border: 1px solid var(--ink-faint, #e1e5ec);
  border-radius: 8px;
  padding: 0;
  max-width: 880px;
  width: 92vw;
  max-height: 88vh;
  overflow: hidden;
  background: white;
}
dialog#job-detail::backdrop { background: rgba(15, 20, 30, 0.5); }
dialog#job-detail article {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}
dialog#job-detail header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--ink-faint, #e1e5ec);
  background: var(--surface, #f8f9fb);
}
dialog#job-detail h2 {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
}
dialog#job-detail .close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft, #687180);
  padding: 0 0.4rem;
}
dialog#job-detail dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  margin: 0;
  padding: 1rem 1.2rem 1.5rem;
  overflow-y: auto;
  font-size: 0.88rem;
}
dialog#job-detail dt {
  color: var(--ink-soft, #687180);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  align-self: center;
}
dialog#job-detail dd { margin: 0; font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; }
dialog#job-detail dt.full, dialog#job-detail dd.full { grid-column: 1 / -1; }
dialog#job-detail dt.full { margin-top: 0.6rem; }
dialog#job-detail pre {
  background: #f8f9fb;
  border: 1px solid var(--ink-faint, #e1e5ec);
  border-radius: 4px;
  padding: 0.6rem 0.8rem;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  max-height: 320px;
  overflow-y: auto;
}
dialog#job-detail .error-row pre { color: #c5350a; background: #fdf5f2; border-color: #fbe7e0; }
dialog#job-detail .error-row.hidden { display: none; }
