:root {
  --canvas: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #1f2937;
  --muted: #667085;
  --line: #d8dee8;
  --line-strong: #b9c3d0;
  --accent: #0f766e;
  --accent-soft: #dff5f1;
  --blue: #2563a9;
  --blue-soft: #e5efff;
  --amber: #9a5b13;
  --amber-soft: #fff2d9;
  --red: #b42318;
  --red-soft: #fde7e7;
  --green: #13795b;
  --green-soft: #e2f4eb;
  --sidebar: #17202f;
  --radius: 8px;
  --shadow: 0 12px 30px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--blue);
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 26px;
  height: 100vh;
  background: var(--sidebar);
  color: #f8fafc;
  padding: 22px 18px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
  background: #f8fafc;
  color: var(--sidebar);
  font-weight: 900;
}

.brand-title {
  font-weight: 850;
}

.brand-subtitle {
  margin-top: 2px;
  color: rgba(248, 250, 252, 0.68);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(248, 250, 252, 0.76);
  padding: 11px 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item:focus-visible,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  outline: none;
}

.sidebar-status {
  display: grid;
  gap: 10px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 16px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(248, 250, 252, 0.68);
  font-size: 12px;
}

.status-row strong {
  max-width: 132px;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-area {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow,
.section-heading p,
.metric span,
.pipeline-step small,
.empty-state small,
.provider-title span,
.progress-meta,
td span,
.provider-meta,
.result-group p,
.prompt-card p,
.api-origin,
.source-tag {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 850;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 4px;
  font-size: 17px;
}

h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.api-origin {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover,
.button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.button-danger {
  color: var(--red);
}

.button-compact {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.icon-button {
  width: 36px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.is-hidden,
.tab-page,
.settings-page {
  display: none !important;
}

.tab-page.is-active,
.settings-page.is-active {
  display: block !important;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.8fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading.compact {
  margin-bottom: 12px;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* 任务详情：历史任务列表 + 返回栏 + 详情内的解析行/提示词折叠 */
.job-list table {
  min-width: 0;
}

.job-list-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.job-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.job-select-col {
  width: 52px;
  text-align: center;
}

.job-row {
  cursor: pointer;
}

.job-row:hover,
.job-row:focus-visible {
  background: var(--surface-soft);
  outline: none;
}

.detail-back {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.detail-title {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.ref-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 13px;
}

.title-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 13px;
}

.title-text {
  overflow-wrap: anywhere;
}

.ref-label {
  flex-shrink: 0;
  color: var(--muted);
  font-weight: 800;
}

.ref-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-detail {
  font-size: 12px;
}

.prompt-detail summary {
  cursor: pointer;
  color: var(--blue);
}

.prompt-detail p {
  margin: 6px 0 0;
  max-height: 160px;
  overflow: auto;
  color: var(--muted);
  white-space: pre-wrap;
}

/* 双击触发器：提示词 / 完整解析结果 */
.prompt-trigger,
.link-button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--blue);
  text-decoration: underline;
}

.prompt-trigger {
  font-size: 12px;
  align-self: flex-start;
}

.ref-trigger {
  cursor: pointer;
}

/* 信息弹窗：解析结果 / 提示词 */
.info-dialog-body {
  max-height: 60vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--ink);
}

.info-section p {
  margin: 0;
  color: var(--muted);
  white-space: pre-wrap;
}

.info-kv,
.info-bullets {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink);
}

.info-bullets li {
  position: relative;
  padding-left: 16px;
  color: var(--muted);
}

.info-bullets li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--blue);
}

.info-kv li {
  display: flex;
  gap: 10px;
}

.info-kv li span {
  flex-shrink: 0;
  min-width: 88px;
  color: var(--muted);
  font-weight: 700;
}

.profile-choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-choice {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  text-align: left;
}

.profile-choice:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.profile-choice strong {
  color: var(--ink);
}

.profile-choice span,
.profile-choice small {
  color: var(--muted);
}

.prompt-full {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
}

.source-preview-dialog {
  width: min(920px, 92vw);
}

.source-preview-stage {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  min-height: 420px;
  background: #101828;
  border-radius: var(--radius);
  padding: 14px;
}

.source-preview-stage img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  margin: 0 auto;
  object-fit: contain;
}

.source-preview-nav {
  background: rgba(255, 255, 255, 0.92);
}

.source-preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.section-heading p,
.result-group p,
.prompt-card p {
  margin-bottom: 0;
  font-size: 13px;
}

.pill,
.chip,
.source-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill-ok {
  border-color: #abd6c8;
  background: var(--green-soft);
  color: var(--green);
}

.pill-warn {
  border-color: #e4c181;
  background: var(--amber-soft);
  color: var(--amber);
}

.pill-blue {
  border-color: #b8cdef;
  background: var(--blue-soft);
  color: var(--blue);
}

.pill-red {
  border-color: #efb5b5;
  background: var(--red-soft);
  color: var(--red);
}

.upload-drop {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 176px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fbfcff;
  padding: 18px;
  cursor: pointer;
}

.upload-drop:hover,
.upload-drop:focus-within,
.upload-drop.is-dragging {
  border-color: var(--accent);
  background: #f4fbf9;
}

.upload-drop strong,
.upload-drop small {
  display: block;
}

.upload-drop small {
  margin-top: 6px;
  color: var(--muted);
}

.upload-visual {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.upload-visual span {
  display: block;
  height: 18px;
  border-radius: 5px;
  background: var(--surface-soft);
}

.upload-visual span:nth-child(2) {
  background: var(--accent-soft);
}

.upload-visual span:nth-child(3) {
  background: var(--blue-soft);
}

.need-list,
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.need-list {
  margin-top: 14px;
}

.need-list span {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px 10px;
}

.template-link {
  display: inline-flex;
  margin-top: 14px;
  font-weight: 800;
}

.auto-start {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px 12px;
  font-size: 13px;
}

.auto-start input {
  width: auto;
  margin: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.metric span {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
}

.metric strong {
  font-size: 26px;
  line-height: 1;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 10px;
  overflow-x: auto;
}

.pipeline-step {
  min-height: 106px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
  padding: 12px;
}

.pipeline-step span {
  display: inline-grid;
  width: 30px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 900;
}

.pipeline-step strong,
.pipeline-step small {
  display: block;
}

.pipeline-step strong {
  margin-top: 10px;
}

.pipeline-step.is-done {
  border-color: #abd6c8;
}

.pipeline-step.is-done span {
  background: var(--green-soft);
  color: var(--green);
}

.pipeline-step.is-active {
  border-color: #b8cdef;
  background: #f7fbff;
}

.pipeline-step.is-active span {
  background: var(--blue-soft);
  color: var(--blue);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

td {
  overflow-wrap: anywhere;
}

td span {
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0;
}

.table-link {
  font-weight: 800;
  text-decoration: none;
}

.cell-spacer {
  height: 8px;
}

.source-stack {
  position: relative;
  width: 68px;
  min-height: 62px;
  margin-bottom: 6px;
}

.source-thumb-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin-bottom: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  position: relative;
  padding: 0;
}

.source-stack .source-thumb-link {
  position: absolute;
  left: 0;
  top: 0;
}

.source-stack .source-thumb-link:nth-child(1) {
  z-index: 3;
}

.source-stack .source-thumb-link:nth-child(2) {
  transform: translate(7px, 5px);
  z-index: 2;
}

.source-stack .source-thumb-link:nth-child(3) {
  transform: translate(14px, 10px);
  z-index: 1;
}

.source-count {
  position: absolute;
  right: -8px;
  bottom: -2px;
  z-index: 4;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 800;
}

.source-thumb-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 图片加载失败（如需登录态的原图源）时显示占位图标，而非裸露的 alt 文本。 */
.source-thumb-link img.is-broken {
  width: 0;
  height: 0;
}

.source-thumb-link::after {
  content: "图";
  position: absolute;
  display: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.source-thumb-link:has(img.is-broken)::after {
  display: block;
}

.muted {
  color: var(--muted);
}

.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
  padding: 14px;
}

.empty-state strong,
.empty-state small {
  display: block;
}

.empty-state small {
  margin-top: 4px;
}

.error-panel,
.result-errors {
  margin-top: 14px;
  border: 1px solid #efb5b5;
  border-radius: var(--radius);
  background: var(--red-soft);
  color: var(--red);
  padding: 14px;
}

.error-list,
.result-errors {
  display: grid;
  gap: 8px;
}

.progress-panel {
  margin-top: 16px;
}

.progress-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef5;
}

#progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  font-size: 13px;
}

.item-progress {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.progress-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
  overflow: hidden;
}

.progress-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 0;
  background: transparent;
  padding: 12px;
  color: inherit;
  text-align: left;
}

.progress-row:hover,
.progress-row:focus-visible {
  background: var(--surface-soft);
  outline: none;
}

.progress-row strong,
.progress-row span {
  display: block;
}

.progress-row span {
  color: var(--muted);
  font-size: 13px;
}

.progress-row-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.progress-chevron {
  color: var(--blue) !important;
  font-weight: 800;
}

.progress-detail {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 12px 12px;
}

.progress-image-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px;
}

.progress-image-row img,
.progress-image-placeholder {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  object-fit: cover;
}

.progress-image-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.progress-image-row div {
  min-width: 0;
  flex: 1 1 auto;
}

.progress-image-row strong,
.progress-image-row span {
  display: block;
}

.progress-image-row div span {
  color: var(--muted);
  font-size: 13px;
}

.progress-image-row div .progress-image-task {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

.progress-error-list {
  display: grid;
  gap: 6px;
  border: 1px solid #efb5b5;
  border-radius: var(--radius);
  background: var(--red-soft);
  color: var(--red);
  padding: 10px;
  font-size: 13px;
}

.source-real {
  border-color: #abd6c8;
  background: var(--green-soft);
  color: var(--green);
}

.source-fallback {
  border-color: #e4c181;
  background: var(--amber-soft);
  color: var(--amber);
}

.result-content {
  display: grid;
  gap: 14px;
}

.result-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
  padding: 14px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.result-image {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.result-image img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface-soft);
  object-fit: cover;
}

.result-image figcaption {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.result-image strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 4px;
}

.settings-tab {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
}

.settings-tab.is-active,
.settings-tab:hover,
.settings-tab:focus-visible {
  background: var(--accent);
  color: #ffffff;
  outline: none;
}

.prompt-library-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.prompt-library-actions select {
  width: 220px;
  min-height: 34px;
  padding: 6px 9px;
  font-size: 13px;
}

.default-library-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.default-library-toggle input {
  width: auto;
}

.default-library-toggle span {
  margin: 0;
  font-size: 13px;
}

.model-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-stack {
  display: grid;
  gap: 12px;
}

label span,
.capability-field legend {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 10px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.textarea {
  min-height: 104px;
  resize: vertical;
}

.textarea.tall {
  min-height: 156px;
}

.provider-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 10px;
}

.provider-heading h3 {
  margin: 0;
}

.provider-list,
.prompt-grid {
  display: grid;
  gap: 12px;
}

.provider-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
  padding: 12px;
}

.provider-title,
.provider-meta,
.provider-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.provider-title span,
.provider-url,
.provider-meta {
  font-size: 13px;
}

.provider-url {
  overflow-wrap: anywhere;
}

.provider-actions {
  justify-content: flex-end;
}

.prompt-grid {
  margin-top: 16px;
}

.prompt-card {
  box-shadow: none;
}

.dialog {
  width: min(680px, calc(100vw - 48px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(31, 41, 55, 0.25);
}

.dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
}

.dialog form {
  padding: 18px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.dialog-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wide {
  grid-column: 1 / -1;
}

.capability-field {
  display: flex;
  gap: 14px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.capability-field label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.capability-field input {
  width: auto;
}

.form-error {
  min-height: 20px;
  margin-top: 10px;
  color: var(--red);
  font-size: 13px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: 420px;
  transform: translateY(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sidebar);
  color: #ffffff;
  padding: 12px 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1180px) {
  .workspace-grid,
  .model-columns {
    grid-template-columns: 1fr;
  }
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #eef2f6;
}

.login-panel {
  width: min(380px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 18px;
  background: var(--sidebar);
  color: #ffffff;
}

.login-panel h1 {
  font-size: 24px;
}

.login-panel > p {
  margin: 6px 0 22px;
  color: var(--muted);
}

.login-form,
.account-form {
  display: grid;
  gap: 12px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 14px;
}

.sidebar-user strong,
.sidebar-user span {
  display: block;
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user span {
  margin-top: 2px;
  color: rgba(248, 250, 252, 0.68);
  font-size: 11px;
}

.sidebar-user-actions {
  display: flex;
  gap: 6px;
}

.sidebar-user .icon-button {
  width: 32px;
  min-height: 32px;
  border-color: rgba(255, 255, 255, 0.22);
  background: transparent;
  color: #ffffff;
  font-size: 12px;
}

.account-form {
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  align-items: end;
}

.account-form .button {
  margin-bottom: 0;
}

.row-actions,
.key-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.compact-dialog {
  width: min(440px, calc(100vw - 32px));
}

.compact-dialog > form > label {
  display: block;
  margin-top: 12px;
}

.config-record-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.config-record {
  display: grid;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.config-record span,
.config-record code {
  overflow-wrap: anywhere;
}

.task-tree {
  display: grid;
  gap: 8px;
}

.task-tree details {
  border-bottom: 1px solid var(--line);
}

.task-tree summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 12px 4px;
  list-style: none;
}

.task-tree summary::-webkit-details-marker {
  display: none;
}

.tree-children {
  display: grid;
  gap: 8px;
  padding: 0 0 12px 18px;
}

.tree-user-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) repeat(3, minmax(80px, auto));
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.tree-user-jobs {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 14px;
    padding: 14px;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    width: auto;
    flex: 0 0 auto;
  }

  .sidebar-status {
    display: none;
  }

  .sidebar-user {
    border-top: 0;
    padding-top: 0;
  }

  .main-area {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
  }

  .account-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-form .button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .brand-subtitle,
  .api-origin {
    display: none;
  }

  .topbar {
    display: grid;
  }

  h1 {
    font-size: 23px;
  }

  .main-area,
  .login-shell {
    padding: 12px;
  }

  .login-panel {
    padding: 20px;
  }

  .workspace-grid,
  .model-columns,
  .metric-grid,
  .form-grid,
  .account-form {
    grid-template-columns: 1fr;
  }

  .pipeline {
    grid-template-columns: 1fr;
  }

  .tree-user-row {
    grid-template-columns: 1fr 1fr;
  }

  .tree-user-row > :first-child,
  .tree-user-jobs {
    grid-column: 1 / -1;
  }

  .job-list {
    max-width: 100%;
    overflow-x: auto;
  }

  .job-list table {
    min-width: 720px;
  }

  .dialog {
    width: calc(100vw - 20px);
  }
}
