:root {
  color-scheme: light;
  --ink: #18211d;
  --muted: #69736e;
  --line: #dce2df;
  --panel: #f5f7f6;
  --white: #ffffff;
  --green: #176b4c;
  --green-soft: #e5f2ec;
  --amber: #9a5d08;
  --amber-soft: #fff3d8;
  --red: #a33a32;
  --red-soft: #fae9e7;
  --blue: #245b88;
  --shadow: 0 12px 32px rgba(24, 33, 29, 0.08);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--white); min-width: 320px; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.workspace { min-height: 100vh; display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.app-sidebar { display: flex; flex-direction: column; min-height: 100vh; padding: 28px 18px 20px; border-right: 1px solid var(--line); background: var(--panel); }
.brand-link { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-link:hover { color: var(--green); }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: var(--ink); color: white; font-size: 12px; font-weight: 800; }
.brand-link h1 { margin: 0; font-size: 14px; line-height: 1.25; }
.brand-link p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.sidebar-nav { margin-top: 42px; }
.sidebar-nav-item { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 0 11px; border-radius: 4px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 750; }
.sidebar-nav-item:hover, .sidebar-nav-item.active { background: var(--green-soft); color: var(--green); }
.sidebar-nav-item span { font-size: 16px; }
.sidebar-footer { display: grid; gap: 15px; margin-top: auto; }
.service-state { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.service-state span { width: 8px; height: 8px; border-radius: 50%; background: #28a56f; box-shadow: 0 0 0 4px var(--green-soft); }
.auth-user { color: var(--muted); font-size: 12px; }
.account-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.text-button { border: 0; padding: 4px 0; background: transparent; color: var(--green); font-size: 12px; font-weight: 750; cursor: pointer; }
.text-button:hover, .text-button:focus-visible { color: var(--ink); text-decoration: underline; outline: none; }
.monitor { padding: 40px clamp(26px, 4vw, 64px); min-width: 0; }
.overview-heading { align-items: center; }
.page-description { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.overview-actions { display: flex; align-items: center; gap: 8px; }
.new-job-button { width: auto; min-height: 40px; margin: 0; padding: 0 15px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.page-heading h2 { margin: 0; font-size: 25px; }
.overview-metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 30px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.overview-metrics > div { padding: 20px 20px 20px 0; }
.overview-metrics span, .overview-metrics strong { display: block; }
.overview-metrics span { color: var(--muted); font-size: 11px; }
.overview-metrics strong { margin-top: 5px; font-size: 25px; }
.task-section { margin-top: 34px; }
.overview-toolbar { display: grid; grid-template-columns: minmax(180px, 1fr) 140px 120px 140px; gap: 8px; margin-top: 14px; }
.overview-toolbar input, .overview-toolbar select { width: 100%; height: 38px; margin: 0; padding: 0 10px; border: 1px solid #cbd3cf; border-radius: 4px; background: var(--white); color: var(--ink); }
.overview-toolbar input:focus, .overview-toolbar select:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); outline: none; }
.overview-error { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 0; padding: 10px 12px; border: 1px solid #e2b4af; background: var(--red-soft); color: var(--red); font-size: 12px; }
.overview-error .secondary-button { min-height: 32px; padding: 0 10px; color: var(--red); border-color: #e2b4af; }
.task-list { display: grid; gap: 10px; margin-top: 13px; }
.task-row { width: 100%; border: 1px solid var(--line); background: var(--white); color: var(--ink); padding: 16px; text-align: left; border-radius: 4px; transition: border-color .15s, background .15s; }
.task-row:hover, .task-row:focus-visible { border-color: var(--green); background: var(--green-soft); outline: none; }
.task-row-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.task-row-heading strong { font-size: 13px; }
.task-row-hint { width: 20px; height: 20px; display: inline-grid; place-items: center; margin-left: auto; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 11px; font-weight: 800; }
.task-row-hint:hover, .task-row-hint:focus-visible { border-color: var(--green); color: var(--green); }
.task-row-summary, .task-row-time { display: block; color: var(--muted); font-size: 12px; }
.task-row-summary { margin-top: 9px; }
.task-row-time { margin-top: 5px; font-size: 11px; }
.task-empty { min-height: 220px; border: 1px dashed var(--line); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; color: var(--muted); text-align: center; }
.task-empty strong { color: var(--ink); font-size: 15px; }
.task-empty-action { width: auto; min-height: 38px; margin-top: 8px; padding: 0 14px; }
.overview-pagination { justify-content: center; margin-top: 18px; }
.detail-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.detail-nav > span { color: var(--muted); font-size: 12px; }
.back-button { border: 0; background: transparent; padding: 0; color: var(--green); font-weight: 750; }
.back-button:hover { color: var(--ink); }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.section-heading.compact { align-items: center; }
.section-heading h2, .section-heading h3 { margin: 0; }
.section-heading h2 { font-size: 23px; }
.section-heading h3 { font-size: 15px; }
.section-heading > span { color: var(--muted); font-size: 12px; }
.eyebrow { color: var(--green); font-size: 10px; font-weight: 800; margin: 0 0 7px; }
.icon-button { border: 1px solid var(--line); background: var(--white); width: 34px; height: 34px; font-size: 20px; color: var(--muted); }
.icon-button:hover { border-color: var(--ink); color: var(--ink); }

form { margin-top: 30px; }
.control-group { border: 0; padding: 0; margin: 0 0 22px; }
.control-group legend, .field-label { display: block; color: #3f4944; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: #e8ecea; }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { height: 38px; display: grid; place-items: center; color: var(--muted); font-weight: 700; font-size: 13px; }
.segmented input:checked + span { background: var(--white); color: var(--ink); box-shadow: 0 2px 8px rgba(24, 33, 29, 0.08); }
textarea, select, input[type="text"], input[type="number"], input[type="password"] { width: 100%; border: 1px solid #cbd3cf; background: var(--white); color: var(--ink); border-radius: 4px; outline: none; }
textarea { min-height: 210px; padding: 13px; resize: vertical; line-height: 1.5; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
select, input[type="text"], input[type="number"], input[type="password"] { height: 42px; padding: 0 10px; margin-top: 8px; }
textarea:focus, select:focus, input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.field-meta { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 110px; gap: 14px; margin-top: 22px; }
.primary-button, .secondary-button, .download-button { border-radius: 4px; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 750; }
.primary-button { width: 100%; margin-top: 22px; border: 0; background: var(--ink); color: white; }
.primary-button:hover { background: var(--green); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); padding: 0 14px; }
.form-error { color: var(--red); background: var(--red-soft); padding: 10px; font-size: 12px; }
.form-retry-button { margin-top: 8px; }
.key-section { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.key-section h3 { margin: 0; font-size: 15px; }
.key-note { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.key-status, #key-status { color: var(--muted); font-size: 11px; }
#key-status.configured { color: var(--green); font-weight: 750; }
.key-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: end; margin-top: 11px; }
.key-entry input[type="password"] { margin-top: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.key-entry .secondary-button { min-height: 42px; }
.key-entry .icon-button { width: 42px; height: 42px; }
.key-message { margin: 8px 0 0; color: var(--green); font-size: 11px; }
.key-message.error { color: var(--red); }

.app-dialog { width: min(680px, calc(100vw - 28px)); max-height: min(760px, calc(100vh - 28px)); margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--ink); box-shadow: 0 24px 70px rgba(24, 33, 29, .22); }
.app-dialog[open] { display: flex; flex-direction: column; }
.app-dialog::backdrop { background: rgba(24, 33, 29, .48); }
.app-dialog form { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; margin: 0; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 0; font-size: 20px; }
.dialog-heading p:not(.eyebrow) { max-width: 500px; margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dialog-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 24px 24px; }
.dialog-body .control-group { margin-bottom: 20px; }
.dialog-body textarea { min-height: 160px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--panel); }
.dialog-footer .primary-button { width: auto; min-width: 150px; margin: 0; padding: 0 16px; }
.create-job-dialog .form-error { margin: 16px 0 0; }
.advanced-settings { margin-top: 20px; border-top: 1px solid var(--line); }
.advanced-settings summary { padding: 13px 0; color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 750; }
.advanced-settings .form-grid { margin-top: 0; }
.create-key-state { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; }
.create-key-state div { display: flex; gap: 10px; align-items: baseline; }
.create-key-state span { color: var(--muted); }
.create-key-state span.configured { color: var(--green); font-weight: 750; }
.create-key-warning { margin: 9px 0 0; color: var(--red); font-size: 11px; }
.settings-dialog { width: min(560px, calc(100vw - 28px)); }
.settings-dialog .key-section { margin: 0; padding: 20px 24px 24px; border-top: 0; }

.job-summary { border: 1px solid var(--line); background: var(--white); }
.job-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding: 18px 20px 14px; }
.job-heading-copy { min-width: 0; }
.job-header h2 { margin: 0; font-size: 22px; }
.job-state-message { max-width: 620px; margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.job-actions { max-width: 55%; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.job-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.job-meta > div { display: inline-flex; gap: 5px; align-items: baseline; }
.job-meta span { color: var(--muted); font-size: 10px; }
.job-meta strong { font-size: 11px; }
.summary-metrics { display: grid; grid-template-columns: repeat(4, minmax(90px, 1fr)); border-top: 1px solid var(--line); }
.summary-metrics > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 20px; border-right: 1px solid var(--line); }
.summary-metrics > div:last-child { border-right: 0; }
.summary-metrics span { color: var(--muted); font-size: 10px; }
.summary-metrics strong { font-size: 18px; }
.status-badge { background: var(--amber-soft); color: var(--amber); padding: 7px 10px; border-radius: 4px; font-size: 12px; font-weight: 750; }
.status-badge.success { background: var(--green-soft); color: var(--green); }
.status-badge.error { background: var(--red-soft); color: var(--red); }

.stage-track { list-style: none; padding: 16px 0; margin: 12px 0 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); }
.stage-track li { display: flex; gap: 9px; align-items: center; position: relative; min-width: 0; }
.stage-track li::after { content: ""; position: absolute; top: 17px; left: 42px; right: 10px; height: 1px; background: var(--line); }
.stage-track li:last-child::after { display: none; }
.stage-track li > span { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--muted); font-size: 11px; z-index: 1; }
.stage-track strong, .stage-track small { display: block; white-space: nowrap; }
.stage-track strong { font-size: 12px; }
.stage-track small { color: var(--muted); font-size: 10px; margin-top: 3px; }
.stage-track .stage-progress { width: max-content; max-width: 100%; margin-top: 5px; color: var(--green); font-weight: 800; }
.stage-track .stage-progress:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.stage-track li.active > span { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.stage-track li.done > span { background: var(--green); border-color: var(--green); color: white; }
.stage-track li.done::after { background: var(--green); }
.stage-track li.failed > span { background: var(--red); color: white; border-color: var(--red); }

.data-section { margin-top: 18px; }
.product-workbench { padding-top: 0; }
.workflow-tabs { display: flex; gap: 24px; margin-top: 18px; border-bottom: 1px solid var(--line); }
.workflow-tab { min-height: 44px; padding: 0 2px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 13px; font-weight: 750; }
.workflow-tab:hover, .workflow-tab:focus-visible { color: var(--ink); outline: none; }
.workflow-tab.active { border-bottom-color: var(--green); color: var(--green); }
.workflow-tab strong { min-width: 22px; margin-left: 4px; padding: 2px 6px; border-radius: 10px; background: var(--panel); color: inherit; font-size: 10px; }
.workbench-message { padding: 11px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.workbench-primary { width: auto; min-width: 130px; margin: 0; padding: 0 15px; }
.records-search { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; }
.records-search > input { min-height: 36px; border: 1px solid var(--line); border-radius: 4px; background: var(--white); color: var(--ink); padding: 0 10px; font-size: 12px; }
.records-search > input { flex: 1 1 320px; min-width: 180px; height: 36px; }
.table-wrap { overflow-x: auto; margin-top: 13px; border: 1px solid var(--line); border-radius: 4px; }
table { width: 100%; min-width: 650px; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; overflow-wrap: anywhere; }
th { background: var(--panel); color: var(--muted); font-size: 10px; }
th.select-column, td.select-column { width: 46px; text-align: center; }
th:nth-child(2) { width: 38%; }
th:nth-child(3) { width: 18%; }
th:nth-child(4), th:nth-child(5), th:nth-child(6) { width: 12%; }
tbody tr:last-child td { border-bottom: 0; }
.table-empty { text-align: center; color: var(--muted); padding: 30px; }
.record-load-error > * { display: block; margin-inline: auto; }
.record-load-error strong { color: var(--danger); font-size: 14px; }
.record-load-error span { max-width: 560px; margin-top: 7px; line-height: 1.55; }
.record-load-error small { margin-top: 6px; color: var(--muted); }
.record-load-error .records-reload-button { margin-top: 14px; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.pagination .secondary-button { min-height: 34px; padding: 0 10px; }
.pagination .secondary-button:disabled { opacity: .45; cursor: not-allowed; }
.cell-status { color: var(--muted); }
.cell-status.ok { color: var(--green); font-weight: 700; }
.cell-status.failed { color: var(--red); font-weight: 700; }
.cell-status[title] { white-space: nowrap; }
.record-name { display: block; font-weight: 700; }
.record-item { display: block; margin-top: 3px; color: var(--green); font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.record-url { display: block; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-action { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--white); color: var(--ink); font-size: 11px; font-weight: 700; }
.table-action:hover, .table-action:focus-visible { border-color: var(--green); color: var(--green); outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.record-row-clickable { cursor: pointer; }
.record-row-clickable:hover, .record-row-clickable:focus-visible { background: var(--green-soft); outline: none; }
.review-dialog { width: min(1180px, calc(100vw - 28px)); height: min(900px, calc(100vh - 28px)); max-height: calc(100vh - 28px); margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--ink); box-shadow: 0 24px 70px rgba(24, 33, 29, .22); }
.review-dialog[open] { display: flex; flex-direction: column; }
.review-dialog::backdrop { background: rgba(24, 33, 29, .48); }
.review-dialog .review-editor-heading > div { display: flex; flex-direction: column; gap: 4px; }
.review-dialog .review-editor-heading > .icon-button { flex: 0 0 34px; }
.review-editor-heading, .review-images-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-editor-heading { padding: 18px 22px; border-bottom: 1px solid var(--line); background: var(--white); }
.review-editor-heading span, .review-images-heading span { color: var(--muted); font-size: 11px; }
.review-source-link { max-width: min(920px, calc(100vw - 120px)); color: var(--green); font-size: 11px; overflow-wrap: anywhere; }
.operational-attention { display: grid; flex: 0 0 auto; position: relative; z-index: 2; gap: 6px; padding: 12px 22px; border-bottom: 1px solid #e2b4af; background: var(--red-soft); color: var(--red); font-size: 12px; }
.operational-attention[hidden] { display: none; }
.operational-attention.info { border-color: var(--line); background: var(--panel); color: var(--muted); }
.operational-attention > span { line-height: 1.5; overflow-wrap: anywhere; }
.review-dialog-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 22px 26px; }
.review-field-section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.review-field-section h3 { margin: 0 0 14px; font-size: 14px; }
.review-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.review-fields.price-pairs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.review-fields .field-label { margin: 0; }
.review-field-source { display: block; min-height: 18px; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; overflow-wrap: anywhere; }
.review-fields .full { grid-column: 1 / -1; }
.review-fields input, .review-fields textarea { width: 100%; margin-top: 7px; padding: 10px; border: 1px solid #cbd3cf; border-radius: 4px; background: var(--white); color: var(--ink); }
.review-field.is-missing > span { color: var(--red); }
.review-field.is-missing input, .review-field.is-missing textarea { border-color: #cc756c; background: var(--red-soft); }
.review-field.is-missing.is-reviewed > span { color: var(--muted); }
.review-field.is-missing.is-reviewed input, .review-field.is-missing.is-reviewed textarea { border-color: var(--line); background: var(--panel); }
.review-fields textarea { min-height: 92px; resize: vertical; overflow: hidden; line-height: 1.55; white-space: pre-wrap; }
.review-fields .read-only { background: var(--panel); color: var(--muted); cursor: default; }
.review-images-section { padding-top: 20px; }
.review-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 10px; margin-top: 12px; }
.review-image { min-width: 0; min-height: 172px; position: relative; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--white); color: var(--ink); font: 11px ui-monospace, monospace; overflow: hidden; }
.review-image > span { overflow-wrap: anywhere; }
.review-image-preview { width: 100%; height: 126px; object-fit: contain; background: var(--panel); cursor: zoom-in; }
.review-image-tools { position: absolute; top: 13px; right: 13px; display: flex; gap: 5px; }
.review-image-tools .icon-button { width: 28px; height: 28px; border-color: rgba(23, 34, 29, .22); background: rgba(255, 255, 255, .94); color: var(--ink); text-decoration: none; }
.review-image.is-empty { justify-content: center; align-items: center; border-style: dashed; background: var(--panel); }
.image-slot-add, .image-append strong { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--white); color: var(--green); font-size: 25px; line-height: 1; cursor: pointer; }
.image-append { align-items: center; justify-content: center; border-style: dashed; cursor: pointer; }
.image-append strong { display: grid; place-items: center; }
.review-dialog-footer { display: flex; flex: 0 0 auto; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--panel); }
.review-dialog-footer > div { display: flex; gap: 8px; }
.review-dialog-footer .primary-button { width: auto; margin: 0; padding: 0 16px; }
.danger-button { min-height: 38px; padding: 0 13px; border: 1px solid #d8a39d; border-radius: 4px; background: var(--white); color: var(--red); font-weight: 750; cursor: pointer; }
.danger-button:hover, .danger-button:focus-visible { background: var(--red-soft); }
.review-dialog > .form-error { margin: 0; padding: 8px 22px; border-top: 1px solid #e2b4af; }
.failed-section { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); }
.section-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.failed-groups { display: grid; gap: 8px; margin-top: 12px; }
.failed-groups details { border: 1px solid var(--line); background: var(--panel); }
.failed-groups summary { cursor: pointer; padding: 11px 12px; font-size: 12px; font-weight: 750; }
.failed-groups summary span { color: var(--muted); font-weight: 500; }
.failed-list { list-style: none; margin: 0; padding: 0 12px 10px; }
.failed-list li { display: grid; gap: 3px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 11px; }
.failed-list code { color: var(--ink); overflow-wrap: anywhere; }
.failed-list li span { color: var(--muted); }
.failed-empty { color: var(--muted); }
.deliverables { display: flex; flex-basis: 100%; justify-content: flex-end; align-items: center; gap: 8px; }
.deliverables > span { color: var(--muted); font-size: 10px; font-weight: 750; }
.artifact-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.download-button { min-height: 34px; background: var(--green); color: white; padding: 0 11px; text-decoration: none; font-size: 11px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 1000; max-width: min(420px, calc(100vw - 32px)); padding: 12px 14px; border: 1px solid #e2b4af; border-radius: 4px; background: var(--red-soft); color: var(--red); box-shadow: var(--shadow); font-size: 12px; }
.toast.info { border-color: #b9cfdf; background: #edf5fb; color: var(--blue); }

.auth-page { min-height: 100vh; display: grid; place-items: center; background: var(--panel); }
.auth-shell { width: min(430px, calc(100vw - 32px)); }
.auth-card { padding: 34px; border: 1px solid var(--line); background: var(--white); box-shadow: var(--shadow); }
.auth-card > .brand-mark { margin-bottom: 24px; }
.auth-card h1 { margin: 0; font-size: 24px; line-height: 1.3; }
.auth-intro { margin: 10px 0 26px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.auth-card form { margin-top: 0; }
.auth-card .field-label + input { margin-bottom: 16px; }
.auth-submit { margin-top: 8px; }
.auth-security-note { margin: 20px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 184px minmax(0, 1fr); }
  .app-sidebar { padding-inline: 14px; }
  .monitor { padding: 30px 24px; }
  .stage-track { grid-template-columns: repeat(2, 1fr); row-gap: 20px; }
  .stage-track li:nth-child(2n)::after, .stage-track li:last-child::after { display: none; }
  .overview-metrics { grid-template-columns: repeat(2, 1fr); }
  .overview-toolbar { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .workspace { display: block; }
  .app-sidebar { min-height: auto; padding: 14px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .app-sidebar .brand-link { min-height: 36px; }
  .app-sidebar .brand-mark { width: 34px; height: 34px; }
  .sidebar-nav { display: none; }
  .sidebar-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
  .service-state { font-size: 11px; }
  .monitor { padding: 28px 18px; }
  .job-header { align-items: stretch; flex-direction: column; }
  .job-actions { max-width: none; justify-content: flex-start; }
  .page-heading { align-items: center; }
  .summary-metrics { grid-template-columns: 1fr 1fr; }
  .summary-metrics > div:nth-child(2) { border-right: 0; }
  .summary-metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .stage-track { grid-template-columns: 1fr 1fr; }
  .stage-track li:nth-child(2n)::after { display: none; }
  .form-grid { grid-template-columns: 1fr 90px; }
  .records-search { align-items: stretch; flex-direction: column; }
  .records-search > input { flex: 0 0 42px; width: 100%; min-height: 42px; }
  .records-search .secondary-button, .records-search .primary-button { width: 100%; }
  .overview-toolbar { grid-template-columns: 1fr; }
  .overview-heading { align-items: flex-start; flex-direction: column; }
  .overview-actions { width: 100%; }
  .overview-actions .new-job-button { flex: 1 1 auto; }
  .app-dialog { width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
  .dialog-heading { padding: 18px; }
  .dialog-body { padding: 18px; }
  .dialog-footer { padding: 12px 18px; }
  .dialog-footer .primary-button { flex: 1 1 auto; min-width: 0; }
  .overview-error { align-items: stretch; flex-direction: column; }
  .workflow-tabs { gap: 10px; justify-content: space-between; }
  .workflow-tab { flex: 1 1 0; }
  .review-dialog { width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
  .review-fields { grid-template-columns: 1fr; }
  .review-fields.price-pairs { grid-template-columns: 1fr; }
  .review-fields .full { grid-column: 1; }
  .review-dialog-footer { align-items: stretch; flex-direction: column-reverse; }
  .review-dialog-footer > div { display: grid; grid-template-columns: 1fr 1fr; }
  .review-dialog-footer .primary-button, .review-dialog-footer .secondary-button, .review-dialog-footer .danger-button { width: 100%; }
}
