/* Record worklists, the operation queue and record inspection. */
.record-browser,
.job-monitor {
  --record-inset: #f7f9fa;
  --record-line: var(--border);
}
.record-browser {
  container: record-browser / inline-size;
}

#filters.toolbar {
  display: grid;
  grid-template-columns: minmax(10rem, 1.8fr) minmax(7.5rem, 1.1fr) repeat(2, minmax(8rem, 1fr)) minmax(7.5rem, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  padding: 14px 20px 16px;
  background: var(--record-inset);
  border-color: var(--border);
}
#filters .field,
#filters .field.search {
  min-width: 0;
}
#filters .field label {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
#filters .field input,
#filters .field select {
  width: 100%;
  height: 36px;
  background: var(--surface);
  border-color: #7b8f9b;
  color: var(--text);
  font-size: 13px;
}
#filters .field input::placeholder {
  color: var(--muted);
}
#filters .field :is(input, select):hover {
  border-color: var(--accent);
}
#filters input[type="date"] {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
#filters .field.search input {
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%234b626e' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='8.6' cy='8.6' r='5.2'/%3E%3Cpath d='m12.4 12.4 4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 17px;
  background-position: 10px center;
}
#filters .button {
  min-height: 36px;
  padding-inline: 13px;
  white-space: nowrap;
}

.record-table-heading,
.job-monitor > .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--record-line);
}
.record-table-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.012em;
}
.record-kicker { display: none; }
.record-result-count {
  color: var(--muted);
  font: 600 10px/1.5 var(--font);
  letter-spacing: .045em;
  flex: 0 0 auto;
  padding: 3px 0 3px 10px;
  border-inline-start: 1px solid var(--record-line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.record-browser .table-wrap,
.job-monitor .table-wrap,
#detail-dialog:not(.merge-player-dialog) .table-wrap {
  position: relative;
  scrollbar-color: #91a3ad var(--surface);
}
.record-browser .table-wrap:focus-visible,
.job-monitor .table-wrap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.record-browser table {
  min-width: 720px;
}
.job-monitor table {
  min-width: 620px;
}
:is(.record-browser, .job-monitor) th,
#detail-dialog:not(.merge-player-dialog) th {
  padding: 9px 16px;
  background: var(--record-inset, var(--surface-raised));
  border-color: var(--border);
  color: var(--muted);
  font: 650 11px/1.5 var(--font);
  letter-spacing: .025em;
}
:is(.record-browser, .job-monitor) td,
#detail-dialog:not(.merge-player-dialog) td {
  padding: 9px 16px;
  border-color: var(--border);
  color: var(--text);
  font-size: 13px;
}
:is(.record-browser, .job-monitor) td.mono,
#detail-dialog:not(.merge-player-dialog) td.mono {
  font-family: var(--mono);
  font-size: 12px;
}
:is(.record-browser, .job-monitor) td strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}
:is(.record-browser, .job-monitor) tbody tr:hover td,
:is(.record-browser, .job-monitor) tbody tr:focus-within td,
#detail-dialog:not(.merge-player-dialog) tbody tr:hover td {
  background: var(--surface-raised);
}
.record-browser :is(th, td):last-child,
.job-monitor :is(th, td):last-child {
  text-align: right;
}
.record-browser td:nth-child(5),
.job-monitor td:nth-child(4) {
  white-space: nowrap;
}
:is(.record-browser, .job-monitor) .row-button {
  min-height: 32px;
  padding: 5px 10px;
  border-color: transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
}
:is(.record-browser, .job-monitor) .row-button:hover {
  background: var(--surface-raised);
  border-color: transparent;
  color: var(--accent);
}
.record-browser [data-record].link-text {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  text-align: left;
}
.record-browser .pagination {
  min-height: 52px;
  padding: 10px 20px;
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
  font: 500 12px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
}
.record-browser .pagination .button {
  min-height: 32px;
  padding: 5px 10px;
  font-family: var(--font);
  white-space: nowrap;
}

.job-monitor td:first-child small {
  margin-top: 4px;
  color: var(--danger);
  font: 500 11px/1.5 var(--mono);
  overflow-wrap: anywhere;
}
.job-summary {
  display: grid;
  margin: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.job-summary > div {
  padding: 12px 20px 14px;
  border-inline-end: 1px solid var(--border);
}
.job-summary > div:last-child {
  border-inline-end: 0;
}
.job-summary dt {
  color: var(--muted);
  font: 600 11px/1.5 var(--font);
  letter-spacing: .04em;
}
.job-summary dd {
  margin: 3px 0 0;
  color: var(--text);
  font: 650 20px/1.15 var(--font);
  font-variant-numeric: tabular-nums;
}
.job-summary .job-summary-ok { color: var(--ok); }
.job-summary .job-summary-error { color: var(--danger); }

#detail-dialog:not(.merge-player-dialog) {
  width: min(960px, calc(100% - 24px));
  max-height: min(92vh, 920px);
  border-color: var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
#detail-dialog:not(.merge-player-dialog) .dialog-header {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--surface);
  border-color: var(--border);
}
#detail-dialog:not(.merge-player-dialog) #detail-body > :is(audio, video) {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-raised);
}
#detail-dialog:not(.merge-player-dialog) #detail-body > video {
  max-height: 48vh;
  background: #14222a;
}
#detail-dialog:not(.merge-player-dialog) #detail-body > .media-pending {
  background: var(--surface-raised);
  border-color: var(--border);
  color: var(--muted);
}
#detail-dialog:not(.merge-player-dialog) .detail-grid {
  gap: 1px;
  margin: 18px 0 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--border);
}
#detail-dialog:not(.merge-player-dialog) .detail-grid > div {
  min-width: 0;
  padding: 12px 14px;
  background: #f7f9fa;
}
#detail-dialog:not(.merge-player-dialog) .detail-grid dt {
  margin-bottom: 5px;
  color: var(--muted);
  font: 650 11px/1.5 var(--font);
  letter-spacing: .045em;
}
#detail-dialog:not(.merge-player-dialog) .detail-grid dd {
  color: var(--text);
  font-size: 13px;
}
#detail-dialog:not(.merge-player-dialog) .detail-note {
  margin-block: 12px;
  color: var(--muted);
  font-size: 12px;
}
#detail-dialog:not(.merge-player-dialog) .detail-source {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #f7f9fa;
  color: var(--muted);
  font: 500 11px/1.6 var(--mono);
}
#detail-dialog:not(.merge-player-dialog) #detail-body > .panel-header {
  margin-top: 18px;
  padding: 11px 0;
  border: 0;
}
#detail-dialog:not(.merge-player-dialog) #detail-body > .table-wrap {
  border: 1px solid var(--border);
  border-radius: 6px;
}

.processing-section {
  --processing-warning: #765124;
  --processing-warning-line: #d9c6a3;
  --processing-warning-surface: #fff8ea;
  container-type: inline-size;
  margin: 20px 0;
  padding-top: 18px;
  border-color: var(--border);
}
.processing-heading h3,
.processing-heading h4 {
  margin: 3px 0 0;
  color: var(--text);
  font-weight: 650;
}
.processing-heading h3 { font-size: 17px; }
.processing-heading h4 { font-size: 13px; }
.processing-stages {
  gap: 8px;
  margin-bottom: 16px;
}
.processing-stage {
  min-height: 75px;
  padding: 10px;
  border-color: var(--border);
  border-radius: 5px;
  background: var(--surface);
}
.processing-stage.complete {
  border-color: #b9d1c3;
  background: #f7faf8;
}
.processing-stage.blocked {
  border-color: var(--processing-warning-line);
}
.stage-number {
  flex-basis: 23px;
  width: 23px;
  height: 23px;
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--muted);
  font-family: var(--mono);
}
.processing-stage.complete .stage-number {
  background: #e5f1e9;
  color: var(--ok);
}
.processing-stage.blocked .stage-number {
  background: var(--processing-warning-surface);
  color: var(--processing-warning);
}
.processing-stage.queued .stage-number {
  background: var(--surface-raised);
  color: var(--accent);
}
.processing-stage strong {
  color: var(--text);
  font-size: 12px;
}
.processing-stage small {
  color: var(--muted);
  font-size: 11px;
}
.processing-stage p {
  color: var(--processing-warning);
  font-size: 11px;
}
.processing-card {
  border-color: var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.processing-card > summary,
.processing-card[open] > summary {
  padding: 12px 14px;
  border-color: var(--border);
  background: #f7f9fa;
  color: var(--text);
  font-size: 13px;
}
.processing-card > summary:hover {
  background: var(--surface-raised);
}
.processing-card > summary:before {
  width: 14px;
  color: var(--accent);
  font: 500 17px/1 var(--mono);
}
.processing-card > summary small {
  color: var(--muted);
  font-size: 11px;
}
.processing-card > form { padding: 14px 16px; }
.processing-card label {
  color: var(--text);
  font-size: 12px;
}
.processing-card input:not([type=checkbox]),
.processing-card textarea {
  background: var(--surface);
  border-color: #7b8f9b;
  color: var(--text);
}
.processing-card input::placeholder,
.processing-card textarea::placeholder {
  color: var(--muted);
}
.processing-card fieldset:disabled input:not([type=checkbox]),
.processing-card fieldset:disabled textarea {
  background: #f3f6f7;
  color: var(--muted);
}
.processing-card .processing-json {
  font-family: var(--mono);
}
.processing-card .processing-confirm {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--text);
}
.processing-confirm input { accent-color: var(--accent); }
.processing-help,
.merge-preflight,
.processing-history small {
  color: var(--muted);
  font-size: 12px;
}
.processing-warning,
.processing-error:not([hidden]) {
  padding: 8px 11px;
  border: 1px solid var(--processing-warning-line);
  border-radius: 4px;
  background: var(--processing-warning-surface);
  color: var(--processing-warning);
}
.processing-error:not([hidden]) {
  border-color: #ebc2bf;
  background: #fff2f0;
  color: var(--danger);
}
.merge-preflight strong,
.processing-history strong,
.latest-merge strong {
  color: var(--text);
  font-size: 12px;
}
.merge-preflight ul,
.latest-merge p {
  color: var(--processing-warning);
}
.merge-preflight .processing-good { color: var(--ok); }
.processing-history,
.processing-history li {
  border-color: var(--border);
}
.latest-merge {
  border-bottom: 1px solid var(--border);
  background: #f7f9fa;
}
.processing-card :is(summary, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

@container (max-width: 685px) {
  .processing-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container record-browser (max-width: 990px) {
  #filters.toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #filters .field.search { grid-column: span 2; }
}
@container record-browser (max-width: 660px) {
  #filters.toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
  }
  #filters .field input,
  #filters .field select { height: 44px; font-size: 16px; }
  #filters input[type="date"] { padding-inline: 6px; }
  #filters .button { width: 100%; min-height: 44px; }
}
@media (max-width: 660px) {
  .record-table-heading,
  .job-monitor > .panel-header,
  .record-browser .pagination {
    padding-inline: 12px;
  }
  .record-browser .pagination .button { min-height: 40px; }
  .record-browser .pagination {
    flex-wrap: wrap;
    gap: 10px;
  }
  .job-summary > div { padding-inline: 12px; }
  .job-summary dt { letter-spacing: 0; }
}
@media (max-width: 430px) {
  .processing-stage { gap: 6px; }
  .processing-card > summary {
    align-items: flex-start;
    gap: 8px;
  }
  .processing-card > summary small { max-width: 90px; }
  .processing-card > form { padding-inline: 12px; }
}

/* List previews are bounded; native title supports hover, details supports tap/keyboard. */
.ptt-transcript-cell { min-width: 15rem; width: 22rem; max-width: 25rem; vertical-align: top; }
.ptt-list-transcript { color: var(--text, #263244); font-size: .82rem; line-height: 1.5; }
.ptt-list-transcript summary { cursor: pointer; overflow-wrap: anywhere; list-style-position: inside; }
.ptt-list-transcript summary:focus-visible { outline: 2px solid var(--accent, #7c3aed); outline-offset: 4px; border-radius: 4px; }
.ptt-list-transcript-full { margin-top: .65rem; padding: .75rem; border: 1px solid var(--line, #e3e7ef); border-radius: 10px; background: var(--surface, #fff); max-height: 15rem; overflow: auto; overflow-wrap: anywhere; }
.ptt-list-transcript-full p { margin: 0; white-space: pre-wrap; }
.ptt-list-transcript-full small { display: block; margin-top: .65rem; color: var(--muted, #68738a); }
.ptt-transcript-unavailable { font-size: .76rem; color: var(--muted, #68738a); }
