:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe4f0;
  --line-soft: #edf2f8;
  --accent: #2f7df6;
  --accent-strong: #1f5fe0;
  --accent-soft: #eef5ff;
  --danger: #dc2626;
  --success: #059669;
  --warning: #d97706;
  --shadow-card: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.06);
}

@keyframes stage-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(22, 119, 255, 0.28);
  }

  70% {
    box-shadow: 0 0 0 9px rgba(22, 119, 255, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(22, 119, 255, 0);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(47, 125, 246, 0.08), transparent 32vw),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(22, 34, 51, 0.08);
}

.brand-row,
.topbar,
.panel-heading,
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.heading-actions,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.task-list-actions,
.user-list-actions {
  align-items: center;
}

.task-search {
  position: relative;
  display: block;
  width: min(300px, 42vw);
}

.task-search::before {
  content: "";
  position: absolute;
  z-index: 1;
  width: 11px;
  height: 11px;
  left: 12px;
  top: 50%;
  border: 1.8px solid #718096;
  border-radius: 50%;
  transform: translateY(-60%);
}

.task-search::after {
  content: "";
  position: absolute;
  z-index: 1;
  width: 6px;
  height: 1.8px;
  left: 22px;
  top: calc(50% + 5px);
  background: #718096;
  border-radius: 2px;
  transform: rotate(45deg);
}

.task-search input {
  width: 100%;
  height: 38px;
  padding: 8px 36px 8px 34px;
  border: 1px solid #d7e2f1;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.task-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.12);
}

.task-search-clear {
  position: absolute;
  z-index: 2;
  right: 5px;
  top: 50%;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #718096;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
}

.task-search-clear:hover {
  background: #eef4fc;
  color: var(--primary);
}

.credit-run-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.credit-run-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

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

h1 {
  font-size: 24px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

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

label,
fieldset {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

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

.flat-fieldset {
  border: 0;
  padding: 0;
}

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

.primary-button,
.ghost-button {
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 7px 13px;
  cursor: pointer;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled,
.primary-button:disabled:hover,
.ghost-button:disabled,
.ghost-button:disabled:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

.primary-button:disabled,
.primary-button:disabled:hover {
  background: #d1d5db;
  color: #6b7280;
}

.ghost-button {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.ghost-button.active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.ghost-button.small {
  min-height: 30px;
  padding: 4px 9px;
}

.primary-button.small {
  min-height: 30px;
  padding: 4px 10px;
}

.hint,
.error-text {
  font-size: 13px;
}

.hint {
  color: var(--muted);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 72px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar p,
.section-title p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.user-chip,
.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.account-menu-trigger {
  cursor: pointer;
  font: inherit;
}

.account-menu-trigger::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.account-menu-trigger.expanded::after { transform: translateY(2px) rotate(225deg); }

.top-actions { position: relative; }

.account-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  border: 1px solid #dfe7f2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, .14);
}

.account-menu-header { display: grid; gap: 4px; padding: 9px 10px; color: #1e293b; }
.account-menu-header span { color: #2563eb; font-weight: 700; }
.account-menu button { width: 100%; padding: 9px 10px; border: 0; background: transparent; text-align: left; color: #475569; }
.account-menu button:disabled { cursor: not-allowed; opacity: .55; }
.account-menu button:hover { background: #f1f5f9; color: #1e293b; }
.account-language-item { border-top: 1px solid #eef2f7; }
.account-language-item > button { display: flex; align-items: center; justify-content: space-between; }
.submenu-arrow { width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .16s ease; }
.account-language-item.open .submenu-arrow { transform: rotate(225deg) translate(-2px, -2px); }
.account-language-menu { display: none; position: static; inset: auto; min-width: 0; padding: 3px 8px 7px; border: 0; border-radius: 0; background: #f8fafc; box-shadow: none; }
.account-language-item.open .account-language-menu { display: block; }
.account-language-menu button { display: flex; align-items: center; justify-content: space-between; }
.account-language-menu button.active { color: #2563eb; font-weight: 700; }
.language-check::after { content: ""; display: block; width: 7px; height: 4px; border-left: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(-45deg); opacity: 0; }
.account-language-menu button.active .language-check::after { opacity: 1; }
.account-menu-divider { height: 1px; margin: 6px 0; background: #e2e8f0; }

.provider-models-modal-dialog { width: min(1120px, calc(100vw - 32px)); }
.provider-model-import-dialog { width: min(540px, calc(100vw - 32px)); }
.csv-file-field { display: grid; gap: 8px; }
.csv-file-field input { padding: 9px; border: 1px dashed #93a4ba; border-radius: 6px; background: #f8fafc; }
.provider-models-list { max-height: min(62vh, 620px); overflow: auto; border: 1px solid #e2e8f0; border-radius: 6px; }
.provider-models-list .data-table-wrap { overflow: auto; }
.provider-models-table { min-width: 1160px; }
.provider-models-table th:nth-child(1) { min-width: 190px; }
.provider-models-table th:nth-child(2) { min-width: 155px; }
.provider-models-table th:nth-child(3), .provider-models-table th:nth-child(4) { width: 94px; text-align: center; }
.provider-models-table td:nth-child(3), .provider-models-table td:nth-child(4) { text-align: center; }
.provider-models-table th:nth-child(5), .provider-models-table th:nth-child(6) { min-width: 135px; }
.provider-models-table th:nth-child(7) { min-width: 250px; }
.provider-model-edit-row td { background: #f8fbff; }
.provider-model-edit-row input { width: 100%; min-width: 0; }
.provider-models-table code { color: #475569; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }
.model-mode-cell { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; min-height: 39px; }
.default-model-label { padding: 1px 6px; border-radius: 999px; background: #dbeafe; color: #1d4ed8; font-size: 11px; font-weight: 700; line-height: 16px; white-space: nowrap; }
.default-model-menu-wrap { position: relative; display: inline-flex; }
.default-model-menu { position: absolute; z-index: 5; top: calc(100% + 5px); left: 0; display: grid; min-width: 170px; padding: 4px; border: 1px solid #dbe3ef; border-radius: 6px; background: #fff; box-shadow: 0 10px 22px rgba(15, 23, 42, .14); }
.default-model-menu button { padding: 7px 9px; border: 0; border-radius: 4px; background: transparent; color: #334155; font: inherit; font-size: 12px; text-align: left; white-space: nowrap; cursor: pointer; }
.default-model-menu button:hover:not(:disabled) { background: #eff6ff; color: #1d4ed8; }
.default-model-menu button:disabled { color: #94a3b8; cursor: not-allowed; }
.ios-switch { position: relative; display: inline-flex; align-items: center; width: 38px; height: 22px; padding: 2px; border: 0; border-radius: 999px; background: #cbd5e1; cursor: pointer; transition: background .18s ease; vertical-align: middle; }
.ios-switch span { display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .25); transform: translateX(0); transition: transform .18s ease; }
.ios-switch.is-on { background: #2563eb; }
.ios-switch.is-on span { transform: translateX(16px); }
.ios-switch:focus-visible { outline: 3px solid rgba(37, 99, 235, .28); outline-offset: 2px; }
.ios-switch:disabled { cursor: not-allowed; opacity: .52; }
.credit-summary { margin: 0 0 12px; padding: 12px; border: 1px solid #dbeafe; border-radius: 8px; background: #eff6ff; color: #1d4ed8; font-weight: 700; }

@media (max-width: 720px) {
  .account-menu { right: 12px; }
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.config-panel,
.run-panel,
.content-page,
.detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.config-panel {
  padding: 16px;
}

.run-panel {
  display: grid;
  gap: 16px;
  padding: 16px;
  min-width: 0;
}

.section-title {
  margin-bottom: 16px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.checkbox-grid label,
.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.checkbox-grid input,
.inline-check input {
  width: auto;
  min-height: auto;
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.active-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

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

.empty-progress-state {
  min-height: 128px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px dashed #cfd7e3;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 18px;
}

.empty-progress-state h3 {
  margin-bottom: 6px;
  color: var(--text);
}

.empty-progress-state p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.empty-progress-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 24px;
  font-weight: 700;
}

.active-progress-state {
  display: grid;
  gap: 16px;
}

.stage-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 0;
  align-items: stretch;
}

.stage-item {
  position: relative;
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 10px;
  color: var(--muted);
  font-size: 13px;
}

.stage-marker {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  border: 2px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.stage-connector {
  position: absolute;
  top: 36px;
  left: 40px;
  right: 0;
  height: 2px;
  background: #d8dee8;
}

.stage-connector.completed {
  background: var(--success);
}

.stage-name {
  color: var(--text);
  font-weight: 800;
}

.stage-state {
  margin-top: 3px;
  font-size: 12px;
}

.stage-item.completed .stage-marker {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.stage-item.running .stage-marker {
  border-color: var(--accent);
  background: #eef6ff;
  color: var(--accent-strong);
  box-shadow: 0 0 0 5px rgba(22, 119, 255, 0.12);
  animation: stage-pulse 1.5s ease-out infinite;
}

.stage-item.running .stage-marker::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #eef6ff;
  background: var(--accent);
}

.stage-item.failed .stage-marker {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.stage-item.cancelled .stage-marker {
  border-color: var(--warning);
  background: #fff7e8;
  color: var(--warning);
}

.stage-item.completed .stage-name,
.stage-item.completed .stage-state {
  color: var(--success);
}

.stage-item.running .stage-name,
.stage-item.running .stage-state {
  color: var(--accent-strong);
}

.stage-item.failed .stage-name,
.stage-item.failed .stage-state {
  color: var(--danger);
}

.stage-item.cancelled .stage-name,
.stage-item.cancelled .stage-state {
  color: var(--warning);
}

.current-stage-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #cfe0f7;
  border-radius: 8px;
  background: #f4f8ff;
  padding: 12px;
}

.current-stage-card h3 {
  margin-top: 4px;
  line-height: 1.35;
}

.current-stage-card.completed {
  border-color: #cfead8;
  background: #f2fbf5;
}

.current-stage-card.failed {
  border-color: #ffd6c2;
  background: #fff7f2;
}

.current-stage-card.cancelled,
.current-stage-card.pending {
  border-color: var(--line);
  background: #fbfcfe;
}

.stage-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.stage-detail-list {
  display: grid;
  gap: 8px;
}

.stage-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.stage-detail summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 800;
}

.stage-detail-status {
  border-radius: 999px;
  padding: 2px 8px;
  background: #f3f5f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stage-detail-status.completed {
  background: #e8f7ee;
  color: var(--success);
}

.stage-detail-status.running {
  background: #eef5ff;
  color: var(--accent-strong);
}

.stage-detail-status.failed {
  background: #fff1ea;
  color: var(--danger);
}

.stage-detail-status.cancelled {
  background: #fff7e8;
  color: var(--warning);
}

.stage-node-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.stage-node {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}

.stage-node + .stage-node {
  border-top: 1px solid #eef2f7;
}

.node-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #cbd5e1;
}

.node-name {
  color: var(--text);
  font-weight: 700;
}

.stage-node.completed .node-dot {
  background: var(--success);
}

.stage-node.running .node-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(22, 119, 255, 0.12);
  animation: stage-pulse 1.5s ease-out infinite;
}

.stage-node.failed .node-dot {
  background: var(--danger);
}

.stage-node.cancelled .node-dot {
  background: var(--warning);
}

.stage-node.completed .node-status {
  color: var(--success);
}

.stage-node.running .node-status {
  color: var(--accent-strong);
}

.stage-node.failed .node-status {
  color: var(--danger);
}

.stage-node.cancelled .node-status {
  color: var(--warning);
}

.split-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.report-stream {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.stream-box,
.detail-content {
  min-height: 420px;
  max-height: 680px;
  overflow: auto;
  container-type: inline-size;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 14px;
}

.stream-box.compact {
  font-size: 12px;
}

.decision-dashboard {
  display: grid;
  gap: 12px;
  padding: 4px 2px 2px;
  white-space: normal;
}

.decision-layout {
  display: grid;
  grid-template-columns: minmax(210px, .82fr) minmax(0, 2.5fr);
  align-items: stretch;
  gap: 16px;
}

.decision-action-panel {
  display: grid;
  grid-template-rows: auto 5px minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 16px;
  min-height: 460px;
  padding: 24px 20px 18px;
  color: #075c4c;
  background: linear-gradient(145deg, #f4fffb 0%, #f8fffd 62%, #f5fbf9 100%);
  border: 1px solid #bce9dc;
  border-radius: 17px;
  box-shadow: 0 3px 9px rgba(38, 102, 83, .08);
}

.decision-action-panel.buy { color: #075c4c; background: linear-gradient(145deg, #effcf7, #f9fffd); border-color: #bce9dc; }
.decision-action-panel.hold { color: #36506f; background: linear-gradient(145deg, #f5f9fe, #fbfdff); border-color: #d5e0ee; }
.decision-action-panel.reduce { color: #b45309; background: linear-gradient(145deg, #fff9ee, #fffdf8); border-color: #f5d9a7; }
.decision-action-panel.sell { color: #c7374a; background: linear-gradient(145deg, #fff3f5, #fffafb); border-color: #f4c7cf; }
.decision-action-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.decision-action-icon { display: inline-grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; color: #fff; font-size: 29px; font-weight: 800; line-height: 1; background: linear-gradient(145deg, #22c78b, #009e70); border: 3px solid #d2f2e5; border-radius: 17px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.5); }
.decision-action-panel.hold .decision-action-icon { background: linear-gradient(145deg, #7b94b2, #59738f); border-color: #e2ebf4; }
.decision-action-panel.reduce .decision-action-icon { background: linear-gradient(145deg, #f5ae35, #e57c15); border-color: #feedd0; }
.decision-action-panel.sell .decision-action-icon { background: linear-gradient(145deg, #f26b7b, #d83b53); border-color: #fde0e5; }
.decision-action-panel strong { color: inherit; font-size: clamp(21px, 1.8vw, 27px); font-weight: 800; letter-spacing: .02em; line-height: 1.12; white-space: nowrap; }
.decision-action-rule { display: block; width: 58px; height: 4px; background: currentColor; border-radius: 999px; opacity: .9; }
.decision-action-copy { align-self: start; margin: 0; color: #1d3553; font-size: 12px; line-height: 1.9; }
.decision-confidence { display: grid; gap: 8px; padding: 12px 10px; border: 1px solid currentColor; border-radius: 11px; background: rgba(255, 255, 255, .45); }
.decision-confidence-heading { display: flex; align-items: center; justify-content: center; gap: 7px; color: inherit; font-size: 14px; }
.decision-confidence-heading span { font-size: 17px; }
.decision-confidence b { color: inherit; }
.decision-confidence-dots { display: flex; justify-content: center; gap: 7px; }
.decision-confidence-dots i { display: block; width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.decision-confidence-dots i.empty { background: transparent; border: 2px solid currentColor; opacity: .45; }
.decision-confidence > span { color: #526174; font-size: 11px; text-align: center; }

.decision-main { display: grid; min-width: 0; grid-template-rows: auto 1fr; gap: 18px; }
.technical-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.technical-metric { display: flex; min-width: 0; min-height: 126px; padding: 16px 12px; flex-direction: column; border: 1px solid #d9e3f0; border-radius: 12px; background: #fff; box-shadow: 0 3px 8px rgba(30, 51, 85, .07); }
.technical-metric h4 { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin: 0; color: #101c38; font-size: 13px; font-weight: 750; white-space: nowrap; }
.technical-metric-icon { color: #1682ee; font-size: 18px; font-weight: 800; line-height: 1; }
.technical-metric.negative .technical-metric-icon { color: #f24758; }
.technical-metric strong { display: block; overflow: hidden; margin-top: 17px; color: #14213d; font-size: clamp(24px, 2vw, 31px); font-weight: 800; line-height: 1; letter-spacing: -.03em; text-overflow: ellipsis; white-space: nowrap; }
.technical-metric span:not(.technical-metric-icon) { align-self: flex-start; max-width: 100%; min-height: 22px; margin-top: auto; padding: 4px 8px; overflow: hidden; color: #3261a3; font-size: 10px; font-weight: 650; line-height: 1.3; text-align: center; text-overflow: ellipsis; white-space: nowrap; background: #eff5fe; border-radius: 7px; }
.technical-metric.positive span:not(.technical-metric-icon) { color: #12976a; background: #e8faf2; }
.technical-metric.negative strong, .technical-metric.negative span:not(.technical-metric-icon) { color: #ed3b50; }
.technical-metric.negative span:not(.technical-metric-icon) { background: #fff0f2; }

.decision-insight-grid { display: grid; grid-template-columns: 1.12fr 1.25fr 1.08fr .67fr; gap: 9px; }
.decision-item {
  min-width: 0;
  min-height: 316px;
  padding: 18px 15px;
  border: 1px solid #d9e3f0;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 3px 8px rgba(30, 51, 85, .06);
}
.decision-item h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 16px; color: #101c38; font-size: 14px; font-weight: 800; white-space: nowrap; }
.decision-item-icon { display: inline-grid; place-items: center; width: 18px; height: 18px; color: #087fe9; font-size: 18px; font-weight: 800; line-height: 1; }
.decision-item.risk .decision-item-icon { color: #fa4854; }
.decision-item p { margin: 0; color: #283a59; font-size: 11px; line-height: 1.82; overflow-wrap: anywhere; }
.decision-item.horizon { display: flex; min-height: 0; flex-direction: column; align-items: center; }
.decision-item.horizon h4 { align-self: stretch; gap: 5px; font-size: 12px; }
.decision-item.horizon .decision-item-icon { width: 16px; height: 16px; font-size: 16px; }
.decision-item.horizon p { width: 100%; margin-top: 5px; padding: 9px 5px; color: #1677e8; font-size: 15px; font-weight: 800; line-height: 1.25; text-align: center; white-space: normal; background: #eff5fe; border-radius: 9px; }
.decision-evidence { border: 1px solid #d9e3f0; border-radius: 12px; background: #fff; }
.decision-evidence summary { padding: 12px 16px; color: #285eaa; font-weight: 700; cursor: pointer; }
.decision-evidence .markdown-body { padding: 0 16px 16px; }

.report-reader-button,
.report-reader-close {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border: 1px solid #d7e2f1;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: #52657d;
  cursor: pointer;
}

.report-reader-button::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1.7px solid currentColor;
  border-radius: 2px;
}

.report-reader-button::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  right: 7px;
  top: 7px;
  border-top: 1.7px solid currentColor;
  border-right: 1.7px solid currentColor;
}

.report-reader-close::before,
.report-reader-close::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 1.8px;
  left: 9px;
  top: 15px;
  border-radius: 2px;
  background: currentColor;
}

.report-reader-close::before { transform: rotate(45deg); }
.report-reader-close::after { transform: rotate(-45deg); }

.report-reader-button:hover,
.report-reader-close:hover {
  border-color: var(--primary);
  background: #f2f7ff;
  color: var(--primary);
}

.markdown-body {
  white-space: normal;
  line-height: 1.65;
  color: var(--text);
  overflow-wrap: anywhere;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 18px 0 10px;
  line-height: 1.25;
  color: #111827;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child {
  margin-top: 0;
}

.markdown-body h1 {
  font-size: 22px;
}

.markdown-body h2 {
  font-size: 18px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.markdown-body h3 {
  font-size: 15px;
}

.markdown-body p {
  margin: 9px 0;
}

.markdown-body ul,
.markdown-body ol {
  margin: 9px 0 12px;
  padding-left: 24px;
}

.markdown-body li {
  margin: 4px 0;
}

.markdown-body strong {
  color: #101828;
}

.markdown-body blockquote {
  margin: 12px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  background: #eef6ff;
  color: #344054;
}

.markdown-body code {
  border: 1px solid #dbe3ef;
  border-radius: 4px;
  background: #eef2f7;
  padding: 1px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.markdown-body pre {
  overflow: auto;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #0f172a;
  color: #e5e7eb;
  padding: 12px;
  white-space: pre;
}

.markdown-body pre code {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}

.markdown-body table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: top;
}

.markdown-body th {
  background: #eef2f7;
  color: #344054;
  font-weight: 700;
}

.markdown-body tr:nth-child(even) td {
  background: #f8fafc;
}

.markdown-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

.event-card {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.event-card:last-child {
  border-bottom: 0;
}

.event-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.content-page {
  margin: 16px;
  padding: 16px;
}

.table-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.model-table-list {
  display: block;
}

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(22, 34, 51, 0.05);
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 14px;
}

.data-table thead {
  display: table-header-group;
}

.data-table th,
.data-table td {
  text-align: left;
  vertical-align: middle;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  background: #e8eef7;
  color: #182436;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid #c9d4e3;
}

.data-table tbody tr {
  background: #fff;
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: #f8fbff;
}

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

.data-table .row-actions {
  justify-content: flex-start;
}

.provider-config-table {
  min-width: 1010px;
}

.runs-table {
  min-width: 1080px;
}

.runs-table td:nth-child(5) {
  overflow-wrap: anywhere;
}

.provider-config-table td:nth-child(2) {
  overflow-wrap: anywhere;
}

.provider-config-table th:nth-child(4),
.provider-config-table td:nth-child(4) {
  min-width: 150px;
}

.inline-provider-credit-factor { width: 100%; min-width: 96px; }
.credit-factor-value { color: #1d4ed8; font-variant-numeric: tabular-nums; }

.user-name-cell {
  font-weight: 700;
}

.password-mask {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.user-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 700;
}

.user-status-pill.active {
  background: #e8f7ee;
  color: var(--success);
}

.user-status-pill.disabled {
  background: #f3f5f8;
  color: var(--muted);
}

.run-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 700;
  background: #f3f5f8;
  color: var(--muted);
}

.run-status-pill.completed {
  background: #e8f7ee;
  color: var(--success);
}

.run-status-pill.running,
.run-status-pill.queued,
.run-status-pill.cancelling {
  background: #eef5ff;
  color: var(--accent-strong);
}

.run-status-pill.failed {
  background: #fff1ea;
  color: var(--danger);
}

.run-status-pill.cancelled {
  background: #f3f5f8;
  color: var(--muted);
}

.table-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  font-size: 14px;
}

.table-row.user-row {
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
}

.table-row.provider-url-row {
  grid-template-columns: 0.9fr 1.8fr 1fr auto;
}

.table-row.provider-url-edit-row {
  align-items: flex-start;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.inline-provider-base-url,
.inline-provider-api-key {
  margin-top: 6px;
}

.row-title {
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.tab-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 5px 10px;
  cursor: pointer;
}

.tab-button.active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.market-options {
  margin: 0;
}

.market-options .tab-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.market-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  min-height: 1px;
  padding: 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(28, 36, 48, 0.48);
}

.modal-dialog {
  width: min(1120px, 100%);
  max-height: min(88vh, 900px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(22, 34, 51, 0.24);
  padding: 16px;
}

.user-modal-dialog {
  width: min(460px, 100%);
  grid-template-rows: auto auto;
}

.modal-heading {
  gap: 12px;
}

.modal-heading h3 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-content {
  min-height: 0;
  overflow: auto;
  padding-right: 6px;
}

.report-reader-overlay {
  z-index: 60;
  padding: 0;
  background: rgba(15, 23, 42, 0.58);
}

.report-reader-dialog {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: #f8fafc;
}

.report-reader-header,
.report-reader-tabs {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.report-reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 12px;
}

.report-reader-title {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 10px;
  font-size: 17px;
}

.report-reader-title strong,
.report-reader-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-reader-tabs {
  padding-bottom: 12px;
}

.report-reader-content {
  width: min(960px, calc(100% - 48px));
  min-height: 0;
  margin: 0 auto;
  padding: 28px 32px 52px;
  overflow: auto;
  container-type: inline-size;
  background: #fff;
  border: 1px solid #e1e9f4;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
  font-size: 16px;
  line-height: 1.82;
}

body.report-reader-open {
  overflow: hidden;
}

@container (max-width: 760px) {
  .decision-layout {
    grid-template-columns: 1fr;
  }

  .decision-action-panel {
    min-height: auto;
  }

  .technical-grid,
  .decision-insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .decision-item {
    min-height: 0;
  }
}

@container (max-width: 470px) {
  .technical-grid,
  .decision-insight-grid {
    grid-template-columns: 1fr;
  }
}

.compact-check {
  min-height: 38px;
  align-items: center;
}

.compact-heading {
  margin-top: 8px;
}

/* Refined workspace theme */
.login-panel,
.config-panel,
.run-panel,
.content-page,
.detail-panel,
.modal-dialog {
  border-color: rgba(203, 213, 225, 0.82);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-card);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1d8cff 0%, #2f66f6 62%, #244de3 100%);
  box-shadow: 0 12px 24px rgba(47, 125, 246, 0.28);
  position: relative;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  bottom: 10px;
  width: 5px;
  border-radius: 999px;
  background: #fff;
}

.brand-mark::before {
  left: 11px;
  height: 13px;
  box-shadow: 8px -5px 0 #fff, 16px -12px 0 #fff;
}

.brand-mark::after {
  left: 9px;
  bottom: 8px;
  width: 24px;
  height: 2px;
  opacity: 0.62;
}

.brand-block h1 {
  font-size: 23px;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand-block p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.topbar {
  min-height: 76px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid rgba(219, 228, 240, 0.86);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.04);
}

.top-actions {
  gap: 10px;
}

.primary-button,
.ghost-button,
.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border-radius: 9px;
  font-weight: 700;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.primary-button {
  background: linear-gradient(135deg, #2f8bff 0%, #2f66f6 100%);
  border-color: #2f66f6;
  box-shadow: 0 12px 24px rgba(47, 102, 246, 0.28);
}

.primary-button:hover {
  background: linear-gradient(135deg, #1f7af0 0%, #214fe0 100%);
  transform: translateY(-1px);
}

.primary-button:disabled,
.primary-button:disabled:hover {
  transform: none;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.9);
  border-color: #dfe7f2;
  color: #1e293b;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.ghost-button:hover {
  border-color: #b8c7db;
  background: #f8fbff;
}

.nav-button.active,
.ghost-button.active.nav-button {
  background: linear-gradient(135deg, #2f8bff 0%, #2f66f6 100%);
  border-color: #2f66f6;
  color: #fff;
  box-shadow: 0 12px 24px rgba(47, 102, 246, 0.26);
}

.button-icon {
  width: 15px;
  height: 15px;
  display: inline-block;
  flex: 0 0 15px;
  border: 1.8px solid currentColor;
  border-radius: 4px;
  position: relative;
}

.icon-workspace {
  border-radius: 50%;
}

.icon-workspace::before {
  content: "";
  position: absolute;
  width: 8px;
  height: 2px;
  left: 7px;
  top: 0;
  background: currentColor;
  transform: rotate(-40deg);
  transform-origin: left center;
}

.icon-tasks::before,
.icon-system::before,
.icon-language::before,
.icon-logout::before,
.icon-logout::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.icon-tasks::before {
  width: 7px;
  height: 1.8px;
  left: 3px;
  top: 4px;
  box-shadow: 0 4px 0 currentColor;
}

.icon-system {
  border-radius: 50%;
}

.icon-system::before {
  width: 5px;
  height: 5px;
  left: 3.2px;
  top: 3.2px;
  border-radius: 50%;
}

.icon-language {
  border-radius: 50%;
}

.icon-language::before {
  width: 1.8px;
  height: 12px;
  left: 5.7px;
  top: 0;
  box-shadow: -4px 5px 0 -3px currentColor, 4px 5px 0 -3px currentColor;
}

.icon-logout {
  border-left-color: transparent;
}

.icon-logout::before {
  width: 7px;
  height: 1.8px;
  right: -4px;
  top: 5px;
}

.icon-logout::after {
  width: 5px;
  height: 5px;
  right: -4px;
  top: 3.2px;
  border-top: 1.8px solid currentColor;
  border-right: 1.8px solid currentColor;
  background: transparent;
  transform: rotate(45deg);
}

.user-chip,
.status-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-color: #dfe7f2;
  color: #334155;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.page-grid {
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 20px;
  padding: 20px 24px 28px;
}

.config-panel,
.run-panel {
  padding: 18px;
}

.section-title {
  margin-bottom: 18px;
}

.section-title h2,
.page-heading h2 {
  font-size: 19px;
}

.section-title p {
  margin-top: 8px;
}

label,
fieldset {
  color: #526172;
  font-size: 13px;
  font-weight: 700;
}

legend {
  color: #526172;
  font-weight: 700;
  padding: 0;
}

input,
select {
  min-height: 40px;
  border-color: #dce5f1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.02);
}

input:focus,
select:focus {
  outline: 0;
  border-color: #8db8ff;
  box-shadow: 0 0 0 3px rgba(47, 125, 246, 0.14);
}

fieldset:not(.flat-fieldset) {
  border-color: #e1e9f4;
  background: #fbfdff;
}

.checkbox-grid {
  gap: 10px;
}

.checkbox-grid label,
.inline-check {
  font-weight: 700;
  color: #334155;
}

.checkbox-grid input,
.inline-check input {
  accent-color: var(--accent);
}

.config-form .primary-button[type="submit"] {
  width: 100%;
  min-height: 44px;
  margin-top: 2px;
}

.config-form .primary-button[type="submit"]::before {
  content: "";
  width: 15px;
  height: 15px;
  display: inline-block;
  border: 1.8px solid currentColor;
  border-radius: 50% 50% 50% 8%;
  transform: rotate(-45deg);
}

.market-options {
  gap: 8px;
}

.market-options .tab-button,
.tab-button {
  min-height: 34px;
  padding: 6px 13px;
  border-color: #dfe7f2;
  background: #fff;
  color: #334155;
  font-weight: 700;
}

.market-options .tab-button.active,
.tab-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: 0 8px 20px rgba(47, 125, 246, 0.1);
}

.status-card {
  align-items: flex-start;
  border-bottom-color: var(--line-soft);
  padding-bottom: 14px;
}

.status-card h2 {
  font-size: 22px;
}

.eyebrow {
  color: #66758a;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.active-summary {
  color: #64748b;
  font-weight: 700;
}

.status-pill {
  color: var(--accent-strong);
  border-color: #cfe0ff;
  background: #f5f9ff;
  font-weight: 800;
}

.empty-progress-state {
  min-height: 150px;
  border-style: solid;
  border-color: #e1e9f4;
  background: linear-gradient(180deg, #fbfdff, #f7faff);
}

.empty-progress-icon {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
  border-radius: 12px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.active-progress-state {
  gap: 14px;
}

.stage-list {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.stage-item {
  min-height: 70px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #fff;
  box-shadow: inset 0 0 0 1px transparent;
}

.stage-item.running {
  border-color: #bdd6ff;
  background: linear-gradient(135deg, #f4f8ff, #eef5ff);
  box-shadow: 0 12px 24px rgba(47, 125, 246, 0.12);
}

.stage-connector {
  left: calc(100% - 6px);
  right: -16px;
  width: 16px;
}

.stage-name {
  font-size: 14px;
}

.current-stage-card {
  border-color: #bdd6ff;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fbff, #eef5ff);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
  padding: 14px;
}

.current-stage-card h3 {
  font-size: 18px;
}

.stage-detail {
  border-color: #e1e9f4;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.025);
}

.stage-detail summary {
  min-height: 44px;
  padding: 10px 14px;
  color: #182436;
}

.stage-node {
  min-height: 40px;
  padding: 9px 14px;
}

.stage-node-list,
.stage-node + .stage-node {
  border-color: #edf2f8;
}

.report-stream,
.split-content {
  gap: 12px;
}

.panel-heading h3 {
  font-size: 18px;
}

.stream-box,
.detail-content {
  border-color: #e1e9f4;
  border-radius: 12px;
  background: #fff;
  padding: 16px;
}

.markdown-body h2 {
  border-bottom-color: #edf2f8;
}

.content-page {
  margin: 20px 24px;
  padding: 18px;
}

.data-table-wrap {
  border-color: #e1e9f4;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

.data-table th {
  background: #f1f6fd;
  color: #243246;
  border-bottom-color: #d7e2f1;
}

.data-table td {
  border-bottom-color: #edf2f8;
}

.data-table tbody tr:hover {
  background: #f8fbff;
}

.run-status-pill,
.user-status-pill,
.stage-detail-status {
  min-height: 25px;
  padding: 3px 10px;
}

.table-row {
  border-color: #e1e9f4;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.035);
}

.modal-overlay {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
}

.modal-dialog {
  border-radius: 14px;
  padding: 18px;
}

.primary-button:disabled,
.primary-button:disabled:hover,
.ghost-button:disabled,
.ghost-button:disabled:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.primary-button:disabled,
.primary-button:disabled:hover {
  background: #d1d5db;
  color: #64748b;
}

@media (max-width: 980px) {
  .topbar,
  .brand-row,
  .status-card,
  .split-content,
  .page-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .brand-row,
  .status-card {
    align-items: flex-start;
  }

  .stage-list {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stage-item {
    min-height: 64px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding-right: 10px;
    background: #fbfcfe;
  }

  .stage-connector {
    display: none;
  }

  .split-content {
    display: grid;
  }

  .table-row,
  .table-row.user-row,
  .table-row.provider-url-row {
    grid-template-columns: 1fr;
  }

  .modal-overlay {
    padding: 10px;
  }

  .modal-dialog {
    max-height: 92vh;
  }
}

@media (max-width: 1180px) {
  .topbar {
    flex-wrap: wrap;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .page-grid {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 12px 14px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .brand-block h1 {
    font-size: 20px;
  }

  .top-actions {
    gap: 8px;
  }

  .ghost-button,
  .primary-button,
  .tab-button {
    min-height: 36px;
    padding: 6px 10px;
  }

  .task-page-heading,
  .user-page-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .task-list-actions,
  .user-list-actions {
    width: 100%;
  }

  .task-search {
    flex: 1 1 100%;
    width: 100%;
  }

  .page-grid,
  .content-page {
    padding: 12px;
    margin: 0;
  }

  .config-panel,
  .run-panel,
  .content-page {
    border-radius: 10px;
  }

  .stage-list {
    grid-template-columns: 1fr;
  }

  .stage-item {
    min-height: 58px;
  }

  .empty-progress-state {
    align-items: flex-start;
  }

  .active-summary,
  .stage-card-meta {
    display: grid;
    gap: 5px;
  }

  .stream-box,
  .detail-content {
    min-height: 320px;
    max-height: 580px;
  }

  .report-reader-header,
  .report-reader-tabs,
  .report-reader-content {
    width: calc(100% - 28px);
  }

  .report-reader-header {
    padding-top: 12px;
  }

  .report-reader-title {
    font-size: 15px;
  }

  .report-reader-content {
    padding: 20px 18px 36px;
    font-size: 15px;
  }
}

@media (max-width: 980px) {
  .page-grid {
    grid-template-columns: 1fr;
  }

  .decision-layout {
    grid-template-columns: minmax(240px, .72fr) minmax(0, 2fr);
    gap: 18px;
  }

  .decision-action-panel {
    min-height: 470px;
    padding: 28px 22px 22px;
  }

  .decision-action-copy,
  .decision-item p {
    font-size: 14px;
  }

  .technical-metric {
    min-height: 165px;
    padding: 21px 18px;
  }

  .technical-metric h4 {
    font-size: 16px;
  }

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

  .decision-insight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .decision-item { min-height: 0; }
}

@media (max-width: 640px) {
  .decision-layout {
    grid-template-columns: 1fr;
  }

  .decision-action-panel {
    min-height: auto;
    padding: 25px 20px;
  }

  .technical-grid,
  .decision-insight-grid {
    grid-template-columns: 1fr;
  }

  .decision-main {
    gap: 18px;
  }

  .technical-metric {
    min-height: 145px;
  }

  .decision-item {
    padding: 23px 20px;
  }
}
