:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-strong: #eef2f7;
  --surface-hover: #f4f7fb;
  --line: #d8dee8;
  --line-strong: #bcc6d4;
  --text: #18212f;
  --muted: #667386;
  --muted-strong: #465365;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e6f5f2;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --warning: #9a5b13;
  --warning-soft: #fff6e6;
  --success: #0f7a42;
  --success-soft: #e9f8ef;
  --radius: 8px;
  --shadow: 0 8px 28px rgba(18, 31, 49, 0.08);
  --shadow-sm: 0 1px 2px rgba(18, 31, 49, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a,
input,
textarea,
select {
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 50;
  transform: translateY(-140%);
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  padding: 8px 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.search-collapsed {
  grid-template-columns: 64px minmax(0, 1fr);
}

.search-panel {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 22px;
  scrollbar-gutter: stable;
}

.search-collapsed .search-panel {
  padding: 14px 10px;
  overflow: hidden;
}

.search-collapsed .brand-block p,
.search-collapsed .brand-block h1,
.search-collapsed .search-form {
  display: none;
}

.search-collapsed .brand-row {
  justify-content: center;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.brand-block {
  margin-bottom: 18px;
}

.brand-row,
.section-title-row,
.config-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand-row h1,
.section-title-row h3 {
  margin-bottom: 0;
}

.section-title-row {
  margin-bottom: 14px;
}

.section-title-row p {
  margin: 4px 0 0;
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 26px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 12px;
  font-size: 16px;
}

p {
  margin-bottom: 14px;
  color: var(--muted);
  line-height: 1.45;
}

.topbar,
.view-header,
.control-panel,
.config-section,
.run-card,
.scoring-controls {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 16px;
}

.topbar h2 {
  margin-bottom: 0;
}

.status {
  max-width: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  color: var(--muted-strong);
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
}

.status.loading {
  border-color: var(--line-strong);
  color: var(--muted-strong);
}

.status.success {
  border-color: rgba(15, 122, 66, 0.25);
  background: var(--success-soft);
  color: var(--success);
}

.status.warning {
  border-color: rgba(154, 91, 19, 0.28);
  background: var(--warning-soft);
  color: var(--warning);
}

.status.error {
  border-color: rgba(180, 35, 24, 0.22);
  background: var(--danger-soft);
  color: var(--danger);
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.tab {
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent;
  color: var(--muted-strong);
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}

.tab:hover {
  background: var(--surface-subtle);
}

.tab.active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent-strong);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 16px;
}

.view-header p {
  margin-bottom: 0;
}

.header-actions,
.run-actions,
.drawer-actions,
.job-card-actions,
.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.force-rerun-control {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
  padding: 9px 11px;
}

.form,
.config-form {
  display: grid;
  gap: 12px;
}

.field-grid,
.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label,
legend {
  display: grid;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 9px 11px;
}

textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--line-strong);
}

.was-validated input:invalid,
.was-validated textarea:invalid,
.was-validated select:invalid {
  border-color: rgba(180, 35, 24, 0.45);
}

fieldset {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.fieldset-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.advanced-sources {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.advanced-sources summary {
  cursor: pointer;
  padding: 11px 12px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 900;
}

.advanced-sources label {
  padding: 0 12px 12px;
}

.checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.checks label,
.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

.checks input,
.inline input {
  width: auto;
  min-height: 0;
}

.notice-inline {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  padding: 10px;
}

button,
#export,
.primary-link {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 9px 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}

button:hover,
#export:hover,
.primary-link:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.icon-action,
button.icon-action {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  min-height: 36px;
  border-color: var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted-strong);
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.icon-action:hover,
button.icon-action:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.secondary-action,
button.secondary-action {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--muted-strong);
}

.secondary-action:hover,
button.secondary-action:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.warning-action,
button.warning-action {
  border-color: rgba(154, 91, 19, 0.35);
  background: var(--warning-soft);
  color: var(--warning);
}

.warning-action:hover,
button.warning-action:hover {
  border-color: var(--warning);
  background: #ffedc2;
  color: var(--warning);
}

.link-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  padding: 0;
  text-align: left;
}

.link-button:hover {
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.summary-tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-tile strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.planned-summary {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

.planned-summary[hidden] {
  display: none;
}

.planned-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.planned-head h3 {
  margin-bottom: 3px;
  font-size: 16px;
}

.planned-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.planned-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.planned-metrics .summary-tile {
  padding: 10px;
}

.planned-metrics .summary-tile strong {
  font-size: 20px;
}

.planned-status-grid,
.planned-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.planned-detail-grid {
  grid-template-columns: minmax(240px, 0.8fr) minmax(260px, 1.2fr);
}

.planned-status-grid article,
.planned-detail-grid section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  padding: 10px;
}

.planned-status-grid p {
  margin: 5px 0 0;
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.5;
}

.planned-detail-grid h4 {
  margin-bottom: 8px;
  font-size: 13px;
}

.planned-detail-grid pre {
  max-height: 220px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  color: var(--muted-strong);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.reason-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reason-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  color: var(--muted-strong);
  font-size: 12px;
}

.reason-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.reason-list strong {
  color: var(--text);
}

.planned-rejected {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.planned-rejected summary {
  cursor: pointer;
  padding: 10px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 900;
}

.rejected-samples {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.rejected-sample {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) auto;
  align-items: start;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.rejected-sample strong {
  font-size: 13px;
}

.rejected-sample p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.rejected-sample dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.rejected-sample dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.rejected-sample dd {
  margin: 2px 0 0;
  color: var(--muted-strong);
  font-size: 12px;
}

.rejected-sample a {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.rejected-sample a:hover,
.rejected-sample a:focus {
  color: var(--accent);
  text-decoration: underline;
}

.control-panel {
  margin-bottom: 14px;
  padding: 12px;
}

.control-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.control-panel-head h3 {
  margin-bottom: 3px;
}

.control-panel-head p {
  margin-bottom: 0;
  font-size: 13px;
}

.view-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.queue-controls {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 12px;
}

.control-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.strictness-switcher {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-subtle);
}

.strictness-option {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted-strong);
  padding: 8px 12px;
  font-weight: 900;
}

.strictness-option + .strictness-option {
  border-left: 1px solid var(--line);
}

.strictness-option:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.strictness-option.active {
  background: var(--accent);
  color: #fff;
}

.job-view {
  border-color: var(--line);
  background: var(--surface-subtle);
  color: var(--text);
}

.job-view:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.job-view.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.toolbar,
.scoring-controls {
  display: grid;
  gap: 10px;
  align-items: end;
}

.toolbar {
  grid-template-columns: minmax(240px, 2fr) repeat(2, minmax(140px, 1fr));
}

.scoring-controls {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.toolbar .span-2 {
  grid-column: auto;
}

.jobs-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.jobs-table,
.steps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.jobs-table {
  min-width: 1320px;
}

.jobs-table th,
.jobs-table td,
.steps-table th,
.steps-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.jobs-table tbody tr:last-child td,
.steps-table tbody tr:last-child td {
  border-bottom: 0;
}

.jobs-table th,
.steps-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-strong);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.job-row:hover td {
  background: var(--surface-hover);
}

.job-row:focus-visible td,
.job-row:focus-within td {
  background: var(--accent-soft);
}

.title-cell {
  width: 220px;
  min-width: 200px;
  max-width: 240px;
  font-weight: 800;
}

.title-cell .link-button {
  overflow-wrap: anywhere;
}

.duplicate-tag {
  margin-top: 6px;
  width: fit-content;
  max-width: 100%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
}

.note-cell {
  width: 360px;
  min-width: 340px;
  max-width: 460px;
  line-height: 1.35;
}

.target-cell {
  width: 230px;
  min-width: 220px;
  max-width: 280px;
}

.two-line,
.title-cell .link-button {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.3;
}

.actions-cell {
  min-width: 250px;
}

.actions-cell button,
.item-actions button,
.drawer-actions button {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
}

.compact-action + .compact-action {
  margin-left: 4px;
}

.tag,
.pill,
.score-badge,
.source-mark,
.confidence-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--muted-strong);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
}

.source-mark {
  justify-content: center;
  width: 34px;
  min-width: 34px;
  padding: 2px 0;
  letter-spacing: 0;
}

.confidence-badge {
  justify-content: center;
  min-width: 42px;
  padding: 2px 7px;
}

.confidence-3 {
  border-color: rgba(15, 122, 66, 0.25);
  background: var(--success-soft);
  color: var(--success);
}

.confidence-2 {
  border-color: rgba(154, 91, 19, 0.25);
  background: var(--warning-soft);
  color: var(--warning);
}

.confidence-1,
.confidence-0 {
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--muted-strong);
}

.score-badge {
  min-width: 112px;
  justify-content: center;
  white-space: nowrap;
}

.score-high {
  border-color: rgba(15, 122, 66, 0.25);
  background: var(--success-soft);
  color: var(--success);
}

.score-mid {
  border-color: rgba(154, 91, 19, 0.25);
  background: var(--warning-soft);
  color: var(--warning);
}

.score-low,
.score-empty {
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--muted-strong);
}

.pill-row,
.job-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-success {
  border-color: rgba(15, 122, 66, 0.25);
  background: var(--success-soft);
  color: var(--success);
}

.pill-muted {
  background: var(--surface-strong);
}

.pill-danger {
  border-color: rgba(180, 35, 24, 0.22);
  background: var(--danger-soft);
  color: var(--danger);
}

.jobs-card-list {
  display: none;
}

.job-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.job-card-title {
  font-size: 15px;
  font-weight: 900;
}

.job-card p {
  margin: 5px 0 0;
}

.job-card-note {
  color: var(--muted-strong);
  font-size: 13px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.job-card-actions {
  margin-top: 12px;
}

.muted-text {
  color: var(--muted);
  font-size: 12px;
}

.empty {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.empty p {
  margin-bottom: 0;
}

.empty-error {
  border-color: rgba(180, 35, 24, 0.22);
  background: var(--danger-soft);
}

.loading-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.skeleton-line {
  display: block;
  width: 100%;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--surface-strong), #f8fafc, var(--surface-strong));
  background-size: 200% 100%;
  animation: shimmer 1.1s linear infinite;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.config-section {
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.config-section.wide {
  grid-column: 1 / -1;
}

.config-form-panel {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  padding: 14px;
}

.config-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.compact-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.config-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
  padding: 10px;
}

.config-item:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.config-item strong {
  display: block;
  margin-bottom: 5px;
}

.config-item p {
  margin-bottom: 0;
  font-size: 13px;
}

.experience-card,
.target-card {
  display: grid;
  gap: 12px;
  background: #fff;
}

.profile-summary {
  display: grid;
  gap: 8px;
}

.profile-card {
  display: grid;
  gap: 12px;
  background: #fff;
}

.profile-notes {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.profile-notes summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-notes p {
  margin: 8px 0 0;
  white-space: pre-wrap;
}

details.config-item {
  display: block;
}

details.config-item summary {
  cursor: pointer;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  list-style: none;
}

details.config-item summary::-webkit-details-marker {
  display: none;
}

details.config-item summary::before {
  content: "›";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted-strong);
  font-size: 18px;
  line-height: 1;
}

details.config-item[open] summary::before {
  transform: rotate(90deg);
}

.collapsible-body {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.config-card-head strong {
  margin-bottom: 4px;
  font-size: 15px;
}

.config-card-head p {
  color: var(--muted-strong);
}

.card-block {
  display: grid;
  gap: 6px;
}

.block-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.clean-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.target-card-grid,
.target-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.point-editor {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
}

.point-editor-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.point-editor-head strong {
  font-size: 13px;
}

.point-editor-head span {
  color: var(--muted);
  font-size: 12px;
}

.point-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.point-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.point-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--line);
  background: transparent;
  padding: 4px 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.point-list li:first-child {
  border-top: 0;
}

.point-row-input {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  padding: 5px 6px;
}

.point-row-input:hover,
.point-row-input:focus {
  border-color: var(--line-strong);
  background: var(--surface-subtle);
}

.remove-point,
button.remove-point {
  min-width: 30px;
  min-height: 30px;
  font-size: 17px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.enabled-toggle {
  min-height: 40px;
  align-self: end;
  justify-content: flex-start;
}

.criteria-group {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.criteria-group + .criteria-group {
  margin-top: 12px;
}

.criteria-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.criteria-group-head h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.criteria-group-head p {
  margin-bottom: 0;
  font-size: 13px;
}

.criteria-total {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 84px;
}

.criteria-total span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.criteria-total strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
}

.criteria-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.criteria-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 13px;
}

.criteria-table th,
.criteria-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.criteria-table tbody tr:last-child td {
  border-bottom: 0;
}

.criteria-table th {
  background: var(--surface-strong);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.criteria-table td:nth-child(1) {
  width: 92px;
}

.criteria-table td:nth-child(2) {
  width: 260px;
}

.criteria-table td:nth-child(3) {
  width: 96px;
}

.criteria-table input,
.criteria-table textarea {
  min-height: 34px;
  padding: 7px 9px;
}

.criteria-group-form[data-editing="false"] .criteria-table input,
.criteria-group-form[data-editing="false"] .criteria-table textarea {
  border-color: transparent;
  background: transparent;
  color: var(--text);
  padding-left: 0;
}

.criteria-group-form[data-editing="false"] .criteria-table textarea {
  resize: none;
}

.criteria-group-form[data-editing="true"] .criteria-table input,
.criteria-group-form[data-editing="true"] .criteria-table textarea {
  background: #fff;
}

.criteria-table textarea {
  min-height: 52px;
  font-family: inherit;
}

.criteria-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.criteria-help {
  margin: 0;
  font-size: 13px;
}

.criteria-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.criteria-invalid {
  border-color: rgba(180, 35, 24, 0.32);
  background: var(--danger-soft);
}

.run-card {
  margin-bottom: 10px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.run-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.run-summary p {
  margin: 4px 0 0;
  font-size: 13px;
}

.steps-table-wrap {
  overflow: auto;
}

.steps-table {
  margin-top: 12px;
  min-width: 760px;
}

.steps-table pre {
  max-width: 460px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 12px;
}

.error-text {
  color: var(--danger);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
}

.drawer.open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(560px, 100%);
  height: 100%;
  overflow: auto;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

.drawer-close {
  position: sticky;
  top: 0;
  float: right;
  width: 38px;
  min-height: 38px;
  border-color: var(--line);
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.drawer-close:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.drawer-header h2 {
  clear: both;
  margin: 12px 0 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
  padding: 10px;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-grid dd {
  margin: 4px 0 0;
  font-weight: 800;
}

.drawer-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 16px;
}

.drawer-section p {
  white-space: pre-wrap;
}

.drawer-section h3 {
  margin-bottom: 8px;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  margin-top: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.search-collapsed {
    grid-template-columns: 1fr;
  }

  .search-panel {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    padding: 18px;
  }

  .toolbar,
  .scoring-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .jobs-table {
    min-width: 1120px;
  }
}

@media (max-width: 760px) {
  .search-panel,
  .workspace {
    padding: 14px;
  }

  .search-panel {
    max-height: 82vh;
    overflow: auto;
  }

  .search-form textarea {
    max-height: 130px;
  }

  .topbar,
  .view-header,
  .control-panel-head,
  .section-title-row,
  .config-card-head,
  .criteria-group-head,
  .criteria-actions,
  .run-summary {
    display: grid;
  }

  .criteria-total {
    justify-items: start;
  }

  .status {
    max-width: none;
  }

  .field-grid,
  .two-column,
  .config-grid,
  .compact-list,
  .target-card-grid,
  .target-editor-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .planned-head,
  .planned-status-grid,
  .planned-detail-grid,
  .rejected-sample {
    grid-template-columns: 1fr;
  }

  .planned-head {
    display: grid;
  }

  .planned-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rejected-sample dl {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .scoring-controls {
    grid-template-columns: 1fr;
  }

  .queue-controls {
    grid-template-columns: 1fr;
  }

  .strictness-switcher {
    display: grid;
    width: 100%;
  }

  .toolbar .span-2 {
    grid-column: auto;
  }

  .jobs-table-wrap {
    display: none;
  }

  .jobs-card-list {
    display: grid;
    gap: 10px;
  }

  details.config-item summary.config-card-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  details.config-item summary.config-card-head .pill,
  details.config-item summary.config-card-head .tag {
    grid-column: 2;
    justify-self: start;
  }

  .job-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .point-entry {
    grid-template-columns: 1fr;
  }

  .job-card-actions a {
    grid-column: 1 / -1;
  }

  .tabs {
    overflow: auto;
  }

  .tab {
    white-space: nowrap;
  }

  button,
  #export,
  .primary-link {
    min-height: 42px;
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .planned-metrics {
    grid-template-columns: 1fr;
  }

  .header-actions,
  .drawer-actions,
  .job-card-actions,
  .form-actions {
    grid-template-columns: 1fr;
  }

  .header-actions > *,
  .drawer-actions > *,
  .job-card-actions > *,
  .form-actions > * {
    width: 100%;
  }

  .drawer-panel {
    padding: 16px;
  }
}
