:root {
  --sidebar-width: 250px;
  --sidebar: #111827;
  --sidebar-muted: #cbd5e1;
  --bg: #f3f6fb;
  --panel: #ffffff;
  --line: #dce3ee;
  --text: #1f2937;
  --muted: #667085;
  --primary: #6b57e8;
  --primary-weak: #eeeaff;
  --success: #00a87e;
  --warning: #f2a93b;
  --danger: #ef5d5d;
  --neutral: #98a2b3;
}

/* Visual case generation prompt contract preview */
.ai-generation-prompt-template details {
  margin-top: 10px;
}

.ai-generation-prompt-template summary {
  cursor: pointer;
  font-weight: 700;
}

.prompt-readonly-textarea {
  width: 100%;
  min-height: 360px;
  margin-top: 12px;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}

/* v0.5 ERP workspace refresh */
:root {
  --sidebar-width: 228px;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #d8dee9;
  --text: #1f2937;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-weak: #eff6ff;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --neutral: #64748b;
}

.sidebar {
  padding: 22px 14px;
}

.brand {
  font-size: 22px;
  line-height: 1.25;
  margin: 6px 8px 18px;
}

.nav {
  gap: 3px;
}

.nav-group-label {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  margin: 16px 12px 6px;
}

.nav a {
  border-radius: 6px;
  font-size: 15px;
  padding: 9px 12px;
}

.nav a.active,
.nav a:hover {
  background: #1d4ed8;
}

.topbar {
  height: 56px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  font-size: 20px;
  font-weight: 700;
}

.topbar span {
  font-size: 14px;
}

.content {
  padding: 20px 28px 40px;
}

.panel {
  padding: 18px 22px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.panel h2 {
  font-size: 18px;
}

.panel h3 {
  font-size: 16px;
}

.muted {
  font-size: 13px;
}

.btn {
  min-height: 34px;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}

.task-context-bar {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 14px;
}

.breadcrumb {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.task-context-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.task-context-main h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.context-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.context-stats span {
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
  color: var(--muted);
  font-size: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 5px 8px;
}

.context-stats strong {
  color: #111827;
  font-size: 15px;
}

.legacy-case-config,
.legacy-case-create {
  display: none;
}

.legacy-case-config.expanded,
.legacy-case-create.expanded {
  display: block;
}

.erp-page-panel > .notice.info,
.erp-page-panel > details.notice.info {
  display: none;
}

.erp-page-panel .panel-title-row {
  align-items: flex-start;
  margin-bottom: 12px;
}

.erp-filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(130px, 0.8fr) minmax(150px, 0.9fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin: 12px 0;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.erp-filter-bar label,
.erp-pagination label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.erp-bulk-toolbar {
  position: sticky;
  top: 56px;
  z-index: 10;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0;
}

.toolbar-metrics {
  font-size: 13px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: #fff;
}

table.erp-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1080px;
}

.erp-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f3f6fc;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.erp-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
  font-size: 13px;
}

.erp-case-row {
  cursor: pointer;
}

.erp-case-row:hover {
  background: #f8fbff;
}

.erp-case-row.selected {
  background: #eff6ff;
}

.select-cell {
  width: 42px;
  text-align: center;
}

.case-main-cell {
  min-width: 260px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 700;
}

.case-title-line {
  max-width: 320px;
  margin-top: 3px;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-subline {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.cell-strong {
  font-weight: 700;
  color: #111827;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-muted {
  color: var(--muted);
  font-size: 12px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #f1f5f9;
  color: #334155;
}

.status-LINKED,
.status-MULTI_LINKED,
.status-READY {
  background: #ecfdf5;
  color: #047857;
}

.status-PENDING_CONFIRM,
.status-REVIEW,
.status-NEED_REVIEW,
.status-NEED_SPLIT {
  background: #fffbeb;
  color: #b45309;
}

.status-UNLINKED,
.status-BLOCKED,
.status-BLOCKED_BY_DEPENDENCY {
  background: #fef2f2;
  color: #b91c1c;
}

.status-NO_DESIGN_NEEDED,
.status-DISABLED,
.status-SKIPPED_BY_DEPENDENCY {
  background: #f1f5f9;
  color: #475569;
}

.row-actions {
  min-width: 210px;
}

.row-actions .btn {
  margin: 2px;
}

.row-save-state {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.row-save-state.unsaved {
  color: var(--warning);
}

.row-save-state.failed {
  color: var(--danger);
}

.erp-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 2px 0;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(720px, calc(100vw - var(--sidebar-width)));
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 32px rgba(15, 23, 42, 0.14);
  z-index: 45;
  display: flex;
  flex-direction: column;
}

.detail-drawer[hidden] {
  display: none;
}

.detail-drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.detail-drawer-header h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.drawer-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--line);
}

.drawer-tab {
  border: 0;
  background: transparent;
  padding: 9px 12px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.drawer-tab.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 16px 20px;
}

.drawer-tab-panel {
  display: none;
}

.drawer-tab-panel.active {
  display: block;
}

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

.drawer-form-grid label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.drawer-wide {
  grid-column: 1 / -1;
}

.drawer-summary-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.drawer-summary-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #edf2f7;
  padding-bottom: 8px;
}

.drawer-summary-list span {
  color: var(--muted);
}

.drawer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
}

.embedded-panel {
  margin-top: 12px;
}

.compact-evidence-list {
  font-size: 12px;
}

@media (max-width: 1100px) {
  .erp-filter-bar {
    grid-template-columns: 1fr 1fr;
  }
  .task-context-main {
    align-items: flex-start;
    flex-direction: column;
  }
  .context-stats {
    justify-content: flex-start;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

/* Auth shell */
body.auth-page {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(37, 99, 235, 0.12), transparent 28%),
    linear-gradient(135deg, #f8fbff 0%, #eef4ff 46%, #f7fafc 100%);
  color: #0f172a;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.auth-panel {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dbe5f3;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.auth-brand strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
}

.auth-brand span:last-child {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 13px;
}

.auth-copy {
  margin-bottom: 22px;
}

.auth-copy .eyebrow {
  margin: 0 0 8px;
  color: #2563eb;
  font-weight: 700;
  font-size: 13px;
}

.auth-copy h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: 0;
}

.auth-copy p {
  margin: 0;
  color: #64748b;
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-weight: 700;
}

.auth-form input {
  height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 12px;
  color: #0f172a;
  background: #fff;
}

.auth-form input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
  border-color: #2563eb;
}

.auth-submit {
  height: 44px;
  margin-top: 4px;
  justify-content: center;
}

.auth-footnote {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.7;
}

.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid #dbe5f3;
  border-radius: 999px;
  background: #f8fafc;
  color: #1e293b;
  font-weight: 700;
}

.topbar-logout {
  margin: 0;
}

.btn.ghost {
  background: #f1f5f9;
  color: #334155;
  border-color: #dbe5f3;
}

.btn.ghost:hover {
  background: #e2e8f0;
  color: #0f172a;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: block;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  background: var(--sidebar);
  color: #fff;
  padding: 34px 18px;
  z-index: 30;
}

.brand {
  font-size: 30px;
  line-height: 1.2;
  font-weight: 800;
  margin-bottom: 24px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  color: var(--sidebar-muted);
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 20px;
}

.nav a.active,
.nav a:hover {
  color: #fff;
  background: var(--primary);
}

.nav-disabled-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-disabled-label span {
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 600;
}

.nav-disabled-link {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #718198;
  cursor: not-allowed;
  font: inherit;
  font-size: 15px;
  padding: 9px 12px;
  text-align: left;
}

.nav-disabled-link:hover,
.nav-disabled-link:focus {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  outline: none;
}

.main {
  min-width: 0;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  overflow-x: hidden;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  background: #fff;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.topbar span {
  color: var(--muted);
  font-size: 18px;
}

.content {
  padding: 28px 34px 48px;
}

.grid {
  display: grid;
  gap: 24px;
}

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

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

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

.panel,
.metric,
.item-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  padding: 28px;
  margin-bottom: 24px;
}

.panel h2,
.panel h3 {
  margin: 0 0 16px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.metric {
  min-height: 120px;
  padding: 22px;
}

.metric label {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
  font-size: 18px;
}

.metric strong {
  color: var(--primary);
  font-size: 38px;
}

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

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 18px;
  background: #eef1f6;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
}

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

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px 20px;
  align-items: center;
}

.form-grid label {
  color: var(--muted);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 14px;
  font: inherit;
  color: var(--text);
  background: #fbfcfe;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

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

.upload-box {
  border: 1px dashed #b9adff;
  border-radius: 8px;
  padding: 22px;
  background: #f7f5ff;
}

.upload-box strong {
  color: var(--primary);
  display: block;
  font-size: 20px;
  margin-bottom: 8px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef2ff;
  color: var(--primary);
  white-space: nowrap;
}

.status {
  display: inline-flex;
  min-width: 86px;
  justify-content: center;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--neutral);
}

.status.done,
.status.saved,
.status.PASS,
.status.READY,
.status.PARSED,
.status.EXTRACTED {
  background: var(--success);
}

.status.active,
.status.SAVED,
.status.UPLOADED {
  background: var(--primary);
}

.status.warn,
.status.REVIEW,
.status.NEED_MANUAL_EXTRACT {
  background: var(--warning);
}

.status.FAIL,
.status.ERROR,
.status.danger {
  background: var(--danger);
}

.flow {
  display: grid;
  grid-template-columns: repeat(9, minmax(76px, 1fr));
  align-items: start;
  gap: 0;
}

.flow-step {
  position: relative;
  text-align: center;
  color: var(--muted);
  min-height: 70px;
}

.flow-step::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 0;
  right: 0;
  height: 4px;
  background: #cfd6df;
}

.flow-step:first-child::before {
  left: 50%;
}

.flow-step:last-child::before {
  right: 50%;
}

.flow-step.done::before,
.flow-step.active::before {
  background: var(--primary);
}

.dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #cfd6df;
  margin: 0 auto 8px;
  position: relative;
  z-index: 1;
}

.flow-step.done .dot,
.flow-step.active .dot {
  background: var(--primary);
}

.flow-step a {
  display: block;
  font-size: 14px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.image-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.thumb {
  width: 100%;
  aspect-ratio: 4 / 2.1;
  border: 1px solid #c6d2ff;
  border-radius: 8px;
  background: #edf2ff;
  object-fit: contain;
  display: block;
}

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

.evidence {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfe;
}

.evidence img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.code-box {
  background: #111827;
  color: #d5fbe8;
  border-radius: 8px;
  padding: 24px;
  min-height: 360px;
  white-space: pre-wrap;
  overflow: auto;
}

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

.log-line {
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.inline-form {
  display: inline;
}

.run-mode-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.run-mode-select {
  display: grid;
  gap: 6px;
  min-width: min(520px, 100%);
  font-weight: 700;
}

.run-mode-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--muted);
  font-weight: 700;
}

.run-mode-checkbox input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  padding: 0;
}

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

.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 12px 0 18px;
  background: #f8fafc;
  color: var(--text);
}

.notice.success {
  border-color: rgba(0, 168, 126, 0.35);
  background: #ecfdf5;
}

.notice.error {
  border-color: rgba(239, 93, 93, 0.35);
  background: #fff1f2;
}

.notice.warning {
  border-color: rgba(242, 169, 59, 0.45);
  background: #fffbeb;
}

.notice.info {
  border-color: rgba(107, 87, 232, 0.28);
  background: #f5f3ff;
}

.notice.compact {
  margin: 8px 0;
  padding: 9px 11px;
}

.global-toast {
  position: fixed;
  top: 68px;
  right: 28px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 48px));
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  font-size: 14px;
  font-weight: 700;
}

.global-toast[hidden] {
  display: none;
}

.global-toast.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.global-toast.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.global-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
}

.global-loading-overlay[hidden] {
  display: none;
}

.global-loading-card {
  width: min(360px, calc(100vw - 48px));
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 22px 24px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
  text-align: center;
}

.global-loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #dbeafe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: global-loading-spin 760ms linear infinite;
}

.global-loading-title {
  color: #0f172a;
  font-size: 15px;
  font-weight: 900;
}

.global-loading-desc {
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.btn.is-loading,
button.is-loading {
  cursor: wait;
}

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

.global-job-bar {
  position: sticky;
  top: 64px;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(160px, 0.85fr) auto;
  gap: 14px;
  align-items: center;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.global-job-bar[hidden] {
  display: none;
}

.global-job-bar.is-terminal {
  border-color: #dbe4ef;
  border-left-color: #94a3b8;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.global-job-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.global-job-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.12);
  flex: 0 0 auto;
}

.global-job-bar:not(.is-terminal) .global-job-dot {
  animation: globalJobPulse 1.4s ease-in-out infinite;
}

.global-job-copy {
  min-width: 0;
}

.global-job-copy strong {
  display: block;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-job-copy span {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-job-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf2;
}

.global-job-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 0.24s ease;
}

.global-job-side {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.global-job-path {
  max-width: 260px;
  color: #64748b;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes globalJobPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
  }
  50% {
    transform: scale(0.86);
    box-shadow: 0 0 0 7px rgba(37, 99, 235, 0.08);
  }
}

@media (max-width: 1100px) {
  .global-job-bar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .global-job-side {
    justify-content: flex-start;
  }

  .global-job-path {
    max-width: min(620px, 100%);
  }
}

.mono {
  font-family: Consolas, "SFMono-Regular", monospace;
  word-break: break-all;
}

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

.ai-summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfe;
}

.ai-summary-card label {
  display: block;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 8px;
}

.ai-summary-card strong {
  display: block;
  font-size: 18px;
}

.ai-switch-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

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

.ai-provider-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.ai-provider-head,
.ai-model-title,
.ai-model-footer {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.ai-provider-head h3 {
  margin-bottom: 4px;
}

.ai-provider-meta {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 14px 0;
}

.ai-provider-meta dt {
  color: var(--muted);
  font-weight: 800;
}

.ai-provider-meta dd {
  margin: 0;
}

.ai-model-details {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.ai-model-details summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 800;
}

.ai-model-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.ai-model-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.ai-model-form.new-model {
  border-style: dashed;
}

.ai-model-form h4 {
  margin: 0 0 12px;
}

.ai-model-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.ai-model-fields label {
  color: var(--muted);
  font-weight: 800;
}

.ai-model-fields input {
  margin-top: 6px;
}

.ai-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 12px 0;
}

.ai-checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-weight: 700;
}

.ai-checkbox-grid input {
  width: auto;
}

.run-step-list {
  display: grid;
  gap: 14px;
}

.run-step-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.run-step-main {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.run-step-thumb {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  place-items: center;
}

.run-step-summary {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.step-primary-line {
  font-weight: 800;
}

.step-chain {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.step-chain span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.step-secondary-line,
.step-no-action {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.step-no-action {
  color: var(--warning);
  font-weight: 800;
}

.step-detail-panel {
  width: min(1180px, 96vw);
}

.step-detail-body {
  display: grid;
  gap: 14px;
}

.step-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 380px);
  gap: 16px;
}

.step-detail-shot {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.step-detail-shot img {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.detail-list {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 8px 12px;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.run-log-box {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  color: #d5fbe8;
  white-space: pre-wrap;
}

.current-run-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 18px;
}

.current-screenshot {
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.current-screenshot img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 6px;
}

.current-run-details {
  display: grid;
  gap: 10px;
  align-content: start;
}

.inline-json {
  margin: 6px 0 0;
  max-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.run-log-table {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.run-log-head,
.run-log-row {
  display: grid;
  grid-template-columns: 150px 64px 120px 56px 150px minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.run-log-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  font-weight: 800;
}

.run-log-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.log-level.ERROR {
  color: var(--danger);
  font-weight: 800;
}

.log-level.WARN {
  color: var(--warning);
  font-weight: 800;
}

.log-level.INFO {
  color: var(--success);
  font-weight: 800;
}

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

.generation-evidence-grid {
  margin-top: 12px;
}

.evidence-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
}

.checkbox-line {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
}

.checkbox-line input {
  width: auto;
}

.prompt-case-list {
  display: grid;
  gap: 16px;
}

.prompt-case-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfe;
}

.prompt-case-card textarea {
  width: 100%;
  min-height: 120px;
  font-family: Consolas, "SFMono-Regular", monospace;
  line-height: 1.5;
}

.prompt-case-card .prompt-preview {
  background: #f8fafc;
}

.prompt-console-context .context-stats {
  align-items: center;
}

.prompt-command-panel {
  padding: 12px 16px;
}

.prompt-command-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.prompt-command-actions {
  justify-content: flex-end;
  margin: 0;
}

.checkbox-line.compact {
  margin: 0;
  white-space: nowrap;
}

.prompt-schema-details {
  margin-top: 10px;
  border-top: 1px solid #edf2f7;
  padding-top: 10px;
}

.prompt-schema-details summary {
  cursor: pointer;
  color: #334155;
  font-weight: 800;
}

.prompt-list-panel {
  padding-bottom: 12px;
}

.prompt-filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(160px, 0.7fr) minmax(150px, 0.7fr) auto;
  gap: 10px;
  align-items: end;
  margin: 10px 0 12px;
}

.prompt-table th:nth-child(1),
.prompt-table td:nth-child(1) {
  width: 170px;
}

.prompt-table th:nth-child(5),
.prompt-table td:nth-child(5) {
  width: 160px;
}

.prompt-table th:nth-child(6),
.prompt-table td:nth-child(6) {
  width: 190px;
}

.prompt-table th:nth-child(7),
.prompt-table td:nth-child(7) {
  width: 240px;
}

.prompt-table .table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.prompt-open-btn.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #1d4ed8;
  font-weight: 800;
  cursor: pointer;
}

.prompt-open-btn.link-button:hover {
  text-decoration: underline;
}

.prompt-row-message {
  min-height: 18px;
  margin-top: 4px;
  font-size: 12px;
}

.prompt-detail-drawer {
  width: min(880px, calc(100vw - var(--sidebar-width)));
}

.prompt-detail-drawer textarea {
  width: 100%;
  font-family: Consolas, "SFMono-Regular", monospace;
  line-height: 1.55;
  resize: vertical;
}

.prompt-detail-drawer label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.compact-code {
  max-height: 220px;
  overflow: auto;
}

.policy-row {
  margin-top: 12px;
}

.inline-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.generation-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.case-sticky-toolbar {
  position: sticky;
  top: 0;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.toolbar-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.case-table th,
.case-table td {
  min-width: 110px;
}

.case-table th.select-cell,
.case-table td.select-cell {
  min-width: 44px;
  width: 44px;
  text-align: center;
}

.case-table th:nth-child(1),
.case-table td:nth-child(1) {
  min-width: 44px;
}

.case-table th:nth-child(2),
.case-table td:nth-child(2) {
  min-width: 150px;
}

.case-table th:nth-child(6),
.case-table td:nth-child(6),
.case-table th:nth-child(7),
.case-table td:nth-child(7) {
  min-width: 220px;
}

.case-table input,
.case-table select,
.case-table textarea {
  min-width: 0;
  margin-bottom: 6px;
}

.case-table textarea {
  min-height: 76px;
}

.case-table tr.unsaved td {
  background: #fffbeb;
}

.case-table tr.failed td {
  background: #fff1f2;
}

.case-table tr.selected td {
  background: #eef6ff;
}

.cell-clip {
  display: block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.two-inputs {
  display: grid;
  gap: 8px;
}

.field-required::after {
  content: " *";
  color: var(--danger);
}

.field-recommended::after,
.field-optional::after {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.field-recommended::after {
  content: "推荐";
  color: #2563eb;
  background: #dbeafe;
}

.field-optional::after {
  content: "可选";
  color: var(--muted);
  background: #eef1f6;
}

.field-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px rgba(239, 93, 93, 0.12);
}

.field-error,
.missing-hint,
.row-save-state.failed {
  color: var(--danger);
}

.field-error {
  min-height: 18px;
  margin-top: 4px;
  font-size: 13px;
}

.missing-hint {
  display: inline-flex;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
}

.design-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.design-count-label,
.primary-design-label {
  font-size: 13px;
}

.design-status-label[data-design-status="LINKED"],
.design-status-label[data-design-status="MULTI_LINKED"],
.quality-chip[data-quality="COMPLETE"],
.row-save-state.saved {
  background: var(--success);
  color: #fff;
}

.design-status-label[data-design-status="UNLINKED"],
.design-status-label[data-design-status="PENDING_CONFIRM"],
.quality-chip[data-quality="NEED_IMPROVE"],
.quality-chip[data-quality="UNLINKED_DESIGN"],
.quality-chip[data-quality="MISSING_REQUIRED"],
.row-save-state.unsaved,
.row-save-state.saving {
  background: var(--warning);
  color: #fff;
}

.design-status-label[data-design-status="NO_DESIGN_NEEDED"] {
  background: var(--primary);
}

.quality-chip,
.row-save-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: var(--neutral);
  color: #fff;
}

.row-more {
  margin-top: 8px;
}

.row-more summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 6px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.5);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(1100px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 24px;
}

.modal-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
  background: #eef1f6;
  border-color: var(--primary);
  outline: none;
}

.compact-modal-panel {
  width: min(720px, 94vw);
}

.modal-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
  margin: 14px 0 18px;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.25s ease;
}

.design-image-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.design-picker-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
}

.design-picker-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(107, 87, 232, 0.14);
}

.design-picker-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 2.2;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin: 8px 0;
}

.design-check,
.design-primary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.design-check input,
.design-primary input {
  width: auto;
}

.ui-sticky-toolbar {
  position: fixed;
  top: 84px;
  left: calc(var(--sidebar-width) + 34px);
  right: 34px;
  z-index: 20;
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  padding: 16px 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.ui-toolbar-spacer {
  height: 190px;
}

.ui-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.ui-toolbar-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.ui-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ui-save-message {
  color: var(--muted);
  min-height: 24px;
}

.ui-save-message.error {
  color: var(--danger);
}

.ui-save-message.success {
  color: var(--success);
}

.image-card.unsaved {
  border-color: var(--warning);
  box-shadow: 0 0 0 2px rgba(242, 169, 59, 0.18);
}

.image-card.failed {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(239, 93, 93, 0.16);
}

.card-save-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.card-error {
  color: var(--danger);
  min-height: 20px;
  font-size: 13px;
}

@media (max-width: 1100px) {
  :root {
    --sidebar-width: 210px;
  }
  .grid-4,
  .grid-3,
  .image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .current-run-grid {
    grid-template-columns: 1fr;
  }
  .run-step-main,
  .step-detail-grid {
    grid-template-columns: 1fr;
  }
  .step-chain {
    grid-template-columns: 1fr;
  }
  .run-log-head,
  .run-log-row {
    grid-template-columns: 120px 56px 96px 44px 120px minmax(180px, 1fr) minmax(180px, 1fr);
  }
  .flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 14px;
  }
  .ui-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .design-image-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ai-provider-grid,
  .ai-summary-grid {
    grid-template-columns: 1fr;
  }
  .ai-model-fields,
  .ai-checkbox-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    position: static;
    width: auto;
    height: auto;
  }
  .main {
    margin-left: 0;
  }
  .ui-sticky-toolbar {
    position: static;
    margin-bottom: 20px;
  }
  .ui-toolbar-spacer {
    display: none;
  }
  .grid-2,
  .grid-3,
  .grid-4,
  .upload-grid,
  .ui-filter-grid,
  .image-grid,
  .evidence-grid {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .run-log-head,
  .run-log-row {
    grid-template-columns: 1fr;
  }
  .case-sticky-toolbar,
  .toolbar-metrics,
  .inline-label,
  .ai-provider-head,
  .ai-model-title,
  .ai-model-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .design-image-picker {
    grid-template-columns: 1fr;
  }
  .ai-model-fields,
  .ai-checkbox-grid,
  .ai-provider-meta {
    grid-template-columns: 1fr;
  }
}

/* v0.5 final ERP overrides. Kept last so legacy page styles cannot win. */
[hidden] { display: none !important; }
.sidebar { padding: 22px 14px; }
.brand { font-size: 22px; line-height: 1.25; margin: 6px 8px 18px; }
.nav { gap: 3px; }
.nav-group-label { color: #94a3b8; font-size: 12px; font-weight: 700; margin: 16px 12px 6px; }
.nav a { border-radius: 6px; font-size: 15px; padding: 9px 12px; }
.nav a.active, .nav a:hover { background: #1d4ed8; }
.topbar { height: 56px; padding: 0 28px; border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 20px; font-weight: 700; }
.topbar span { font-size: 14px; }
.content { padding: 20px 28px 40px; }
.panel { padding: 18px 22px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
.panel h2 { font-size: 18px; }
.panel h3 { font-size: 16px; }
.muted { font-size: 13px; }
.btn { min-height: 34px; border-radius: 6px; padding: 7px 12px; font-size: 13px; font-weight: 600; }
input, select, textarea { border-radius: 6px; padding: 8px 10px; font-size: 13px; }
.task-context-bar { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; margin-bottom: 14px; }
.breadcrumb { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.task-context-main { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.task-context-main h2 { margin: 0 0 6px; font-size: 18px; }
.context-stats { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.context-stats span { display: inline-flex; gap: 5px; align-items: baseline; color: var(--muted); font-size: 12px; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 6px; padding: 5px 8px; }
.context-stats strong { color: #111827; font-size: 15px; }
.legacy-case-config, .legacy-case-create { display: none; }
.legacy-case-config.expanded, .legacy-case-create.expanded { display: block; }
.erp-page-panel > .notice.info, .erp-page-panel > details.notice.info { display: none; }
.erp-page-panel .panel-title-row { align-items: flex-start; margin-bottom: 12px; }
.erp-filter-bar { display: grid; grid-template-columns: minmax(240px, 2fr) minmax(130px, 0.8fr) minmax(150px, 0.9fr) minmax(180px, 1fr) auto; gap: 10px; align-items: end; margin: 12px 0; padding: 12px; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 8px; }
.erp-filter-bar label, .erp-pagination label { color: var(--muted); font-size: 12px; font-weight: 700; }
.erp-bulk-toolbar { position: sticky; top: 56px; z-index: 10; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 12px 0; }
.toolbar-metrics { font-size: 13px; }
.table-wrap { border: 1px solid var(--line); border-radius: 8px; overflow: auto; background: #fff; }
table.erp-table { border-collapse: separate; border-spacing: 0; min-width: 1080px; }
.erp-table th { position: sticky; top: 0; z-index: 2; background: #f3f6fc; color: #475569; font-size: 12px; font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.erp-table td { padding: 9px 10px; border-bottom: 1px solid #edf2f7; vertical-align: middle; font-size: 13px; }
.erp-case-row { cursor: pointer; }
.erp-case-row:hover { background: #f8fbff; }
.erp-case-row.selected { background: #eff6ff; }
.select-cell { width: 42px; text-align: center; }
.case-main-cell { min-width: 260px; }
.link-button { border: 0; background: transparent; color: var(--primary); cursor: pointer; padding: 0; font: inherit; font-weight: 700; }
.case-title-line { max-width: 320px; margin-top: 3px; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.case-subline { display: flex; gap: 8px; margin-top: 4px; color: var(--muted); font-size: 12px; }
.cell-strong { font-weight: 700; color: #111827; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-muted { color: var(--muted); font-size: 12px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-pill { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #f1f5f9; color: #334155; }
.status-LINKED, .status-MULTI_LINKED, .status-READY { background: #ecfdf5; color: #047857; }
.status-PENDING_CONFIRM, .status-REVIEW, .status-NEED_REVIEW, .status-NEED_SPLIT { background: #fffbeb; color: #b45309; }
.status-UNLINKED, .status-BLOCKED, .status-BLOCKED_BY_DEPENDENCY { background: #fef2f2; color: #b91c1c; }
.status-NO_DESIGN_NEEDED, .status-DISABLED, .status-SKIPPED_BY_DEPENDENCY { background: #f1f5f9; color: #475569; }
.row-actions { min-width: 210px; }
.row-actions .btn { margin: 2px; }
.row-save-state { margin-top: 4px; font-size: 12px; color: var(--muted); }
.row-save-state.unsaved { color: var(--warning); }
.row-save-state.failed { color: var(--danger); }
.erp-case-row .case-row-fields { display: none !important; }
.erp-case-row td { height: 56px; max-height: 72px; }
.erp-case-row .case-main-cell,
.erp-case-row .design-cell,
.erp-case-row .row-actions { vertical-align: middle; }
.erp-case-row .case-title-line,
.erp-case-row .cell-strong,
.erp-case-row .cell-muted,
.erp-case-row .design-count-label,
.erp-case-row .primary-design-label { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erp-case-row .case-subline { flex-wrap: nowrap; }
.erp-case-row .row-actions { min-width: 180px; white-space: nowrap; }
.erp-case-row .row-actions .btn { margin: 1px; padding: 4px 7px; min-height: 28px; }
.erp-case-row .row-save-state { margin-top: 2px; }
.erp-pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 2px 0; }
.erp-client-pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 2px 0; color: #64748b; font-size: 13px; }
.erp-client-pagination[hidden] { display: none; }
.erp-pager-total strong { color: #0f172a; font-size: 14px; }
.erp-pager-controls { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.erp-pager-size select { min-width: 118px; height: 34px; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 0 10px; color: #334155; }
.erp-pager-current { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; color: var(--primary); font-weight: 800; }
.erp-pager-jump { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: #64748b; }
.erp-pager-jump input { width: 64px; height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; text-align: center; }
.erp-pager-controls .btn.icon { width: 32px; min-height: 32px; padding: 0; font-size: 18px; color: #64748b; }
.erp-pager-controls .btn.icon:disabled { opacity: 0.38; cursor: not-allowed; }
.detail-drawer { position: fixed; top: 0; right: 0; width: min(720px, calc(100vw - var(--sidebar-width))); height: 100vh; background: #fff; border-left: 1px solid var(--line); box-shadow: -16px 0 32px rgba(15, 23, 42, 0.14); z-index: 45; display: flex; flex-direction: column; }
.detail-drawer[hidden] { display: none; }
.detail-drawer-header { display: flex; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.detail-drawer-header h2 { margin: 0 0 6px; font-size: 18px; }
.drawer-tabs { display: flex; gap: 4px; padding: 10px 16px 0; border-bottom: 1px solid var(--line); }
.drawer-tab { border: 0; background: transparent; padding: 9px 12px; color: var(--muted); cursor: pointer; font-weight: 700; }
.drawer-tab.active { color: var(--primary); border-bottom: 2px solid var(--primary); }
.drawer-body { flex: 1; overflow: auto; padding: 16px 20px; }
.drawer-tab-panel { display: none; }
.drawer-tab-panel.active { display: block; }
.drawer-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.drawer-form-grid label { color: var(--muted); font-size: 12px; font-weight: 700; }
.drawer-wide { grid-column: 1 / -1; }
.drawer-summary-list { display: grid; gap: 10px; margin-bottom: 14px; }
.drawer-summary-list div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #edf2f7; padding-bottom: 8px; }
.drawer-summary-list span { color: var(--muted); }
.drawer-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); }
.compact-evidence-list { font-size: 12px; }
@media (max-width: 1100px) {
  .erp-filter-bar { grid-template-columns: 1fr 1fr; }
  .task-context-main { align-items: flex-start; flex-direction: column; }
  .context-stats { justify-content: flex-start; }
  .detail-drawer { width: calc(100vw - 16px); }
}

/* v0.6 console workspace sample: AI visual execution */
:root {
  --sidebar: #0f172a;
  --bg: #f4f6fa;
  --primary: #1d4ed8;
  --primary-weak: #eaf2ff;
  --line: #d9e1ec;
  --panel-soft: #f8fafc;
}

.topbar { height: 52px; }
.topbar h1 { font-size: 18px; }
.content { padding-top: 16px; }
.panel { padding: 16px 18px; margin-bottom: 14px; }
.panel h2 { font-size: 17px; margin-bottom: 8px; }
.btn { min-height: 32px; padding: 6px 11px; border-radius: 6px; }
.btn.primary { background: #1d4ed8; border-color: #1d4ed8; }
.btn.danger { background: #dc2626; border-color: #dc2626; }
.metric { min-height: auto; padding: 14px 16px; }
.metric label { font-size: 13px; margin-bottom: 6px; }
.metric strong { font-size: 22px; color: #1d4ed8; }

.ai-console-context { margin-bottom: 12px; }

.task-picker-hero {
  margin-bottom: 14px;
}

.task-path-guide {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.task-path-guide span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 800;
}

table.erp-table.task-picker-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

.task-picker-table th:nth-child(1),
.task-picker-table td:nth-child(1) {
  width: 30%;
}

.task-picker-table th:nth-child(2),
.task-picker-table td:nth-child(2) {
  width: 16%;
}

.task-picker-table th:nth-child(3),
.task-picker-table td:nth-child(3) {
  width: 30%;
}

.task-picker-table th:nth-child(4),
.task-picker-table td:nth-child(4) {
  width: 120px;
}

.task-picker-table th:nth-child(5),
.task-picker-table td:nth-child(5) {
  width: 150px;
  position: sticky;
  right: 0;
  z-index: 3;
  background: #fff;
  box-shadow: -8px 0 12px rgba(15, 23, 42, 0.04);
}

.task-picker-table th:nth-child(5) {
  background: #f3f6fc;
  z-index: 4;
}

.task-picker-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-picker-actions {
  min-width: 138px;
  text-align: right;
}

.empty-state {
  min-height: 150px;
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: #0f172a;
  font-size: 16px;
}

.empty-state span {
  display: block;
}

.ai-command-panel { position: sticky; top: 52px; z-index: 20; }
.ai-command-bar {
  display: grid;
  grid-template-columns: minmax(170px, 0.9fr) minmax(120px, 0.55fr) minmax(150px, 0.75fr) auto minmax(420px, auto);
  gap: 10px;
  align-items: end;
  margin-top: 10px;
}
.ai-command-bar label { color: var(--muted); font-size: 12px; font-weight: 700; }
.ai-command-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ai-checkbox-inline { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; color: #334155; }
.ai-checkbox-inline input { width: 16px; height: 16px; padding: 0; }
.more-menu { position: relative; }
.more-menu > summary { list-style: none; cursor: pointer; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 210px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  display: grid;
  gap: 4px;
  z-index: 50;
}
.more-menu-panel a,
.more-menu-panel button {
  width: 100%;
  display: block;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  padding: 8px 10px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.more-menu-panel a:hover,
.more-menu-panel button:hover { background: #f1f5f9; }
.ai-resume-strip {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 6px;
  font-size: 13px;
}

.ai-overview-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.1fr 1fr 1.25fr 0.8fr 0.9fr 1.9fr 0.9fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.ai-overview-groups {
  display: grid;
  grid-template-columns: minmax(560px, 1.6fr) minmax(360px, 1fr) minmax(180px, 0.45fr);
  gap: 10px;
  margin-bottom: 14px;
}

.ai-overview-group {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.ai-group-title {
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 8px;
}

.ai-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ai-group-grid.result-grid {
  grid-template-columns: minmax(180px, 1.5fr) minmax(120px, 0.8fr) minmax(110px, 0.7fr);
}

.ai-group-grid.perf-grid {
  grid-template-columns: 1fr;
}
.ai-kpi {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}
.ai-kpi span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.ai-kpi strong {
  display: block;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-kpi.primary strong { color: #1d4ed8; }
.ai-kpi.wide { grid-column: span 2; }

.ai-run-summary-panel,
.run-detail-summary-panel {
  margin-bottom: 14px;
  border-color: #cfe0ff;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.run-summary-conclusion {
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-left: 3px solid #2563eb;
  border-radius: 6px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.6;
}

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

.run-summary-grid > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e5eaf2;
  border-radius: 6px;
  background: #fff;
}

.run-summary-grid span {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.run-summary-grid strong {
  display: block;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.run-summary-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.run-summary-reasons span {
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid #e5eaf2;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.ai-workbench-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(360px, 1.2fr) minmax(300px, 0.85fr);
  gap: 14px;
  align-items: stretch;
}
.ai-shot-pane,
.ai-chain-pane,
.ai-diagnosis-pane {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
  min-width: 0;
}
.ai-pane-title { color: #334155; font-size: 13px; font-weight: 800; margin-bottom: 10px; }
.ai-shot-frame {
  width: 100%;
  min-height: 320px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  cursor: pointer;
}
.ai-shot-frame img { max-width: 100%; max-height: 430px; object-fit: contain; }
.ai-chain { display: grid; gap: 10px; }
.ai-chain-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid #e5eaf2;
  background: #fff;
  border-radius: 8px;
}
.ai-chain-item strong { display: block; color: #0f172a; font-size: 14px; margin-bottom: 4px; }
.ai-chain-item small { display: block; color: #475569; font-size: 13px; line-height: 1.45; word-break: break-word; }
.chain-dot { width: 10px; height: 10px; margin-top: 4px; border-radius: 999px; background: #94a3b8; }
.chain-dot.done { background: #059669; }
.chain-dot.ai { background: #2563eb; }
.chain-dot.action { background: #7c3aed; }
.chain-dot.safety { background: #d97706; }
.chain-dot.executor { background: #0f766e; }

.ai-diagnosis-list { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 9px 10px; margin: 0 0 12px; }
.ai-diagnosis-list dt { color: var(--muted); font-size: 12px; font-weight: 800; }
.ai-diagnosis-list dd { margin: 0; color: #0f172a; font-size: 13px; word-break: break-word; }
.ai-perf-mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ai-perf-mini span {
  background: #fff;
  border: 1px solid #e5eaf2;
  border-radius: 6px;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}
.ai-perf-mini strong { display: block; margin-top: 3px; color: #0f172a; font-size: 12px; }

.ai-bottom-grid { display: grid; grid-template-columns: minmax(420px, 0.95fr) minmax(520px, 1.05fr); gap: 14px; }
.compact-row { align-items: flex-start; margin-bottom: 10px; }
.compact-steps {
  display: grid;
  gap: 8px;
  max-height: none;
  overflow: visible;
  padding-right: 4px;
}
.compact-step-card {
  width: 100%;
  border: 1px solid #e5eaf2;
  border-left: 3px solid transparent;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}
.compact-step-card:hover { border-color: #93c5fd; background: #f8fbff; }
.compact-step-card.selected {
  border-color: #93c5fd;
  border-left-color: #2563eb;
  background: #eff6ff;
}
.step-row-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.step-case-title {
  margin: 4px 0 3px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.compact-step-card .muted,
.step-chain-line {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.step-chain-line { margin-top: 5px; color: #334155; font-size: 12px; }
.ai-steps-pagination {
  margin-top: 10px;
  border-top: 1px solid #edf2f7;
  padding-top: 10px;
}
.drawer-step-shot {
  min-height: 220px;
  display: grid;
  place-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
}
.drawer-step-shot img {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  background: #fff;
}
.drawer-step-shot a {
  color: #2563eb;
  font-size: 12px;
  text-decoration: none;
}
.drawer-step-shot a:hover { text-decoration: underline; }
.run-step-card > img,
.step-detail img {
  display: block;
  max-width: min(320px, 100%);
  max-height: 360px;
  object-fit: contain;
  margin: 10px 0;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
}
.compact-log { max-height: 300px; }
.compact-log .run-log-row { grid-template-columns: 150px 64px 120px minmax(220px, 1fr); }
.log-actions { margin-top: 8px; }
.ai-precheck-panel { margin-top: 14px; }
.ai-precheck-panel summary { cursor: pointer; font-weight: 800; color: #334155; }
.ai-run-drawer { width: min(760px, calc(100vw - var(--sidebar-width))); }
.ai-run-drawer .inline-json { max-height: 260px; overflow: auto; }
.ai-run-detail-modal {
  z-index: 96;
  align-items: center;
  justify-content: center;
  padding: 28px;
}
.ai-run-detail-panel {
  width: min(1180px, calc(100vw - 72px));
  max-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #cfdbea;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.28);
}
.ai-run-detail-panel .detail-drawer-header {
  flex: 0 0 auto;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #e8eef6;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.08), rgba(255, 255, 255, 0) 58%),
    #fff;
}
.ai-run-detail-panel .drawer-tabs {
  flex: 0 0 auto;
  padding: 8px 18px 0;
}
.ai-run-detail-panel .drawer-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 16px 22px;
}
.ai-run-detail-panel .drawer-footer {
  flex: 0 0 auto;
  padding: 12px 22px;
  background: #f8fafc;
}
.ai-run-detail-panel .drawer-tab-panel.active[data-ai-drawer-panel="overview"] {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(460px, 1.28fr);
  gap: 14px 18px;
  align-items: start;
}
.ai-run-detail-panel .drawer-tab-panel.active[data-ai-drawer-panel="overview"] .drawer-step-shot {
  grid-row: span 8;
  margin: 0;
}
.ai-run-detail-panel .drawer-tab-panel.active[data-ai-drawer-panel="overview"] h3 {
  margin: 2px 0 8px;
}
.ai-run-detail-panel .drawer-summary-list {
  margin-bottom: 10px;
}
.ai-run-detail-panel .drawer-summary-list div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 10px;
}
.ai-run-detail-panel .drawer-summary-list strong {
  text-align: left;
}
.ai-run-detail-panel .evidence-goal-list strong {
  white-space: normal;
  line-height: 1.5;
}
body.ai-run-modal-open {
  overflow: hidden;
}

@media (max-width: 1500px) {
  .ai-overview-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ai-overview-groups { grid-template-columns: 1fr; }
  .ai-command-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ai-command-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 1200px) {
  .ai-workbench-grid,
  .ai-bottom-grid { grid-template-columns: 1fr; }
  .ai-shot-frame { min-height: 260px; }
}

@media (max-width: 760px) {
  .ai-overview-grid,
  .ai-overview-groups,
  .run-summary-grid,
  .ai-group-grid,
  .ai-group-grid.result-grid,
  .ai-command-bar { grid-template-columns: 1fr; }
  .ai-kpi.wide { grid-column: auto; }
  .ai-run-drawer { width: 100vw; }
}

/* v0.7 global ERP shell polish: light console, compact tables, safer modals */
:root {
  --sidebar-width: 220px;
  --sidebar-collapsed-width: 64px;
  --sidebar: #ffffff;
  --sidebar-muted: #475569;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #d7e0ec;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-weak: #eaf2ff;
  --primary-soft: #f4f8ff;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --neutral: #64748b;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.app-shell {
  background: linear-gradient(180deg, #f8fbff 0, #f5f7fb 180px);
}

.sidebar {
  width: var(--sidebar-width);
  background: #fff;
  color: #0f172a;
  border-right: 1px solid #dbe4ef;
  box-shadow: 2px 0 10px rgba(15, 23, 42, 0.04);
  padding: 14px 10px 18px;
}

.brand-row {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 4px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  color: #0f172a;
  font-weight: 800;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #1d4ed8;
  color: #fff;
  font-size: 14px;
  letter-spacing: 0;
  flex: 0 0 auto;
}

.brand-text {
  white-space: nowrap;
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  cursor: pointer;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus {
  background: #eff6ff;
  border-color: #93c5fd;
  color: var(--primary);
  outline: none;
}

.nav {
  gap: 2px;
}

.nav-group-label {
  color: #7b8798;
  font-size: 12px;
  font-weight: 800;
  margin: 14px 10px 5px;
}

.nav a,
.nav-disabled-link {
  min-height: 36px;
  display: flex;
  align-items: center;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.2;
}

.nav a {
  color: #334155;
}

.nav a:hover {
  color: #1d4ed8;
  background: #eef6ff;
}

.nav a.active {
  color: #1d4ed8;
  background: #dbeafe;
  font-weight: 800;
  box-shadow: inset 3px 0 0 #2563eb;
}

.nav-disabled-label {
  color: #7b8798;
}

.nav-disabled-label span {
  color: #94a3b8;
}

.nav-disabled-link {
  color: #9aa6b2;
  cursor: help;
}

.nav-disabled-link:hover,
.nav-disabled-link:focus {
  background: #f1f5f9;
  color: #64748b;
}

.main {
  margin-left: var(--sidebar-width);
  transition: margin-left 0.18s ease;
}

.topbar {
  height: 54px;
  padding: 0 26px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid #dbe4ef;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.topbar h1 {
  font-size: 18px;
  font-weight: 800;
}

.topbar span {
  font-size: 13px;
  color: #64748b;
}

.content {
  padding: 16px 26px 36px;
}

.panel,
.task-context-bar,
.ai-command-panel,
.ai-overview-card,
.ai-workbench-card,
.ai-bottom-card,
.ai-precheck-panel {
  border-radius: 8px;
  border-color: #dbe4ef;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.task-context-bar {
  padding: 12px 16px;
}

.breadcrumb {
  color: #64748b;
}

.btn {
  border-radius: 6px;
}

.btn.primary {
  background: #2563eb;
  border-color: #2563eb;
}

.btn.primary:hover,
.btn.primary:focus {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.table-wrap {
  border-color: #dbe4ef;
  border-radius: 8px;
}

table.erp-table {
  background: #fff;
}

.erp-table th {
  background: #f3f7fd;
  color: #475569;
  font-size: 12px;
  padding: 8px 10px;
}

.erp-table td {
  padding: 8px 10px;
  font-size: 13px;
}

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

.global-toast {
  left: auto;
  right: 26px;
  top: 66px;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

.modal-backdrop {
  background: rgba(15, 23, 42, 0.34);
}

.modal-panel {
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.2);
}

.modal-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 22px;
}

.detail-drawer {
  box-shadow: -18px 0 42px rgba(15, 23, 42, 0.16);
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
  padding-left: 8px;
  padding-right: 8px;
}

body.sidebar-collapsed .main {
  margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .brand-row {
  justify-content: center;
  margin-left: 0;
  margin-right: 0;
}

body.sidebar-collapsed .brand {
  justify-content: center;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-group-label {
  display: none;
}

body.sidebar-collapsed .brand-row {
  flex-direction: column;
  gap: 6px;
}

body.sidebar-collapsed .sidebar-toggle {
  width: 34px;
  height: 28px;
}

body.sidebar-collapsed .nav a,
body.sidebar-collapsed .nav-disabled-link {
  justify-content: center;
  padding: 8px 0;
  font-size: 0;
}

body.sidebar-collapsed .nav a::before,
body.sidebar-collapsed .nav-disabled-link::before {
  content: attr(data-short);
  font-size: 12px;
  font-weight: 800;
}

body.sidebar-collapsed .nav a.active {
  box-shadow: inset 0 -3px 0 #2563eb;
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 64px;
  }

  .sidebar {
    padding-left: 8px;
    padding-right: 8px;
  }

  .brand-text,
  .nav-group-label,
  .sidebar-toggle {
    display: none;
  }

  .nav a,
  .nav-disabled-link {
    justify-content: center;
    padding: 8px 0;
    font-size: 0;
  }

  .nav a::before,
  .nav-disabled-link::before {
    content: attr(data-short);
    font-size: 12px;
    font-weight: 800;
  }

  .content {
    padding: 14px 16px 28px;
  }
}

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

.erp-summary-strip div {
  min-height: 72px;
  padding: 12px 16px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.erp-summary-strip span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.erp-summary-strip strong {
  color: #1d4ed8;
  font-size: 24px;
  line-height: 1;
}

.workbench-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  position: relative;
  padding: 18px 20px;
  margin-bottom: 14px;
  border: 1px solid #c8d8f0;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
  background: linear-gradient(90deg, #ffffff 0%, #f7fbff 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.workbench-top h2 {
  margin: 0 0 6px;
  color: #0f172a;
  font-size: 22px;
  font-weight: 800;
}

.workbench-top p {
  margin: 0;
  max-width: 760px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.7;
}

.workbench-top.compact {
  align-items: center;
  min-height: 92px;
}

.workbench-top.compact h2 {
  margin-bottom: 4px;
}

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

.workbench-alert-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: center;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.workbench-alert-chip:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.workbench-alert-chip span {
  font-size: 13px;
  font-weight: 900;
}

.workbench-alert-chip strong {
  font-size: 22px;
  line-height: 1;
}

.workbench-alert-chip small {
  grid-column: 1 / -1;
  color: #64748b;
  font-size: 12px;
}

.workbench-alert-chip.danger {
  border-color: #fecaca;
  background: #fff7f7;
}

.workbench-alert-chip.danger strong {
  color: #dc2626;
}

.workbench-alert-chip.warning {
  border-color: #fed7aa;
  background: #fffbeb;
}

.workbench-alert-chip.warning strong {
  color: #d97706;
}

.workbench-alert-chip.primary strong {
  color: #2563eb;
}

.workbench-alert-chip.neutral strong {
  color: #64748b;
}

.workbench-task-panel {
  margin-bottom: 0;
}

.workbench-priority-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: #334155;
  font-size: 13px;
}

.priority-label,
.priority-warning,
.priority-ok {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.priority-label {
  color: #1d4ed8;
  background: #dbeafe;
}

.priority-warning {
  color: #b45309;
  background: #fef3c7;
}

.priority-ok {
  color: #047857;
  background: #d1fae5;
}

.workbench-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(360px, 0.72fr);
  gap: 14px;
  margin-bottom: 14px;
}

.workbench-focus,
.workbench-todo {
  margin-bottom: 0;
}

.workbench-focus {
  border-top: 3px solid #2563eb;
}

.workbench-todo {
  border-top: 3px solid #f59e0b;
}

.section-kicker {
  margin-bottom: 4px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.section-kicker.danger {
  color: #d97706;
}

.workbench-focus-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
  background: #f8fbff;
}

.focus-eyebrow {
  margin-bottom: 5px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
}

.workbench-focus-title {
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
}

.workbench-focus-title:hover {
  color: #2563eb;
}

.workbench-package {
  margin-top: 8px;
  color: #475569;
  font-size: 12px;
}

.workbench-task-health {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.workbench-task-health div,
.workbench-kpi-grid div {
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #fff;
}

.workbench-task-health div {
  min-height: 62px;
  padding: 9px 10px;
}

.workbench-task-health span,
.workbench-kpi-grid span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.workbench-task-health strong {
  display: block;
  margin-top: 7px;
  color: #1d4ed8;
  font-size: 20px;
  line-height: 1;
}

.workbench-last-run {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 12px;
}

.workbench-last-run strong {
  color: #0f172a;
}

.workbench-last-run.empty {
  display: block;
  color: #64748b;
}

.workbench-action-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.action-card {
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 12px 14px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  text-decoration: none;
}

.action-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.action-card span {
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.action-card strong {
  font-size: 18px;
  line-height: 1.2;
}

.action-card small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.action-card.primary-action {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.action-card.primary-action span,
.action-card.primary-action small {
  color: #dbeafe;
}

.action-card.warning-action {
  border-color: #fed7aa;
  background: #fffbeb;
}

.action-card.warning-action strong {
  color: #b45309;
}

.workbench-quick-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.quick-link-label {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.workbench-todo-list {
  display: grid;
  gap: 8px;
}

.todo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: relative;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  text-decoration: none;
}

.todo-item:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.todo-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: #94a3b8;
}

.todo-item strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
}

.todo-item small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.todo-item b {
  color: #1d4ed8;
  font-size: 22px;
  line-height: 1;
}

.todo-item.danger b {
  color: #dc2626;
}

.todo-item.warning b {
  color: #d97706;
}

.todo-item.danger {
  border-color: #fecaca;
  background: #fff7f7;
}

.todo-item.danger::before {
  background: #dc2626;
}

.todo-item.warning {
  border-color: #fed7aa;
  background: #fffbeb;
}

.todo-item.warning::before {
  background: #f59e0b;
}

.todo-item.primary::before {
  background: #2563eb;
}

.todo-item.neutral b {
  color: #64748b;
}

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

.workbench-kpi-grid div {
  min-height: 66px;
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.workbench-kpi-grid span {
  margin-bottom: 8px;
}

.workbench-kpi-grid strong {
  color: #0f172a;
  font-size: 22px;
  line-height: 1;
}

.dashboard-filter-bar {
  grid-template-columns: minmax(260px, 1.5fr) minmax(150px, 0.7fr) minmax(150px, 0.7fr) auto;
}

table.erp-table.workbench-task-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.workbench-current .compact-flow {
  margin-top: 12px;
}

.workbench-task-table th:nth-child(1),
.workbench-task-table td:nth-child(1) {
  width: 23%;
}

.workbench-task-table th:nth-child(2),
.workbench-task-table td:nth-child(2) {
  width: 13%;
}

.workbench-task-table th:nth-child(3),
.workbench-task-table td:nth-child(3) {
  width: 15%;
}

.workbench-task-table th:nth-child(4),
.workbench-task-table td:nth-child(4) {
  width: 12%;
}

.workbench-task-table th:nth-child(5),
.workbench-task-table td:nth-child(5) {
  width: 16%;
}

.workbench-task-table th:nth-child(6),
.workbench-task-table td:nth-child(6) {
  width: 12%;
}

.workbench-task-table th:nth-child(7),
.workbench-task-table td:nth-child(7) {
  width: 9%;
}

.workbench-log-list {
  display: grid;
  gap: 0;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  overflow: hidden;
}

.workbench-log-list .log-line {
  display: grid;
  grid-template-columns: 170px 180px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #edf2f7;
  background: #fff;
  color: #334155;
  font-size: 13px;
}

.workbench-log-list .log-line:last-child {
  border-bottom: 0;
}

.workbench-log-list .log-line strong {
  color: #0f172a;
}

.workbench-log-list.compact {
  max-height: 260px;
  overflow: auto;
}

.workbench-task-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
  white-space: nowrap;
}

.workbench-task-actions .btn.small {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
}

.workbench-task-table .truncate-cell,
.workbench-task-table td:not(.workbench-task-actions) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.workbench-task-table td.workbench-task-actions {
  overflow: visible;
}

.risk-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.risk-pill.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.risk-pill.warning {
  background: #fef3c7;
  color: #b45309;
}

.risk-pill.primary {
  background: #dbeafe;
  color: #1d4ed8;
}

.risk-pill.neutral {
  background: #f1f5f9;
  color: #64748b;
}

.workbench-task-table tbody tr {
  cursor: pointer;
}

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

.workbench-task-drawer {
  width: min(680px, calc(100vw - var(--sidebar-width)));
}

.drawer-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

.drawer-metric-grid div {
  min-height: 66px;
  padding: 10px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #f8fafc;
}

.drawer-metric-grid span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.drawer-metric-grid strong {
  display: block;
  margin-top: 8px;
  color: #1d4ed8;
  font-size: 22px;
  line-height: 1;
}

.drawer-section-title {
  margin: 16px 0 10px;
  color: #0f172a;
  font-size: 15px;
}

.drawer-summary-list.compact {
  margin-bottom: 8px;
}

.drawer-log-list {
  display: grid;
  gap: 8px;
}

.drawer-log-line {
  display: grid;
  grid-template-columns: 135px minmax(100px, 0.5fr) minmax(0, 1fr);
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #fff;
}

.drawer-log-line strong {
  color: #0f172a;
  font-size: 13px;
}

.drawer-log-line small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.project-table {
  min-width: 1180px;
}

.project-table th:nth-child(1),
.project-table td:nth-child(1) {
  width: 22%;
}

.project-table th:nth-child(2),
.project-table td:nth-child(2) {
  width: 14%;
}

.project-table th:nth-child(3),
.project-table td:nth-child(3) {
  width: 20%;
}

.project-table th:nth-child(4),
.project-table td:nth-child(4) {
  width: 90px;
}

.project-table th:nth-child(5),
.project-table td:nth-child(5) {
  width: 160px;
}

.project-table th:nth-child(7),
.project-table td:nth-child(7) {
  width: 180px;
}

.project-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.truncate-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-detail-drawer {
  width: min(520px, calc(100vw - var(--sidebar-width)));
}

.erp-upload-form {
  display: grid;
  gap: 14px;
}

.erp-upload-types {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.erp-upload-types div {
  min-height: 74px;
  padding: 12px 14px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fbff;
}

.erp-upload-types strong {
  display: block;
  margin-bottom: 8px;
  color: #0f172a;
}

.erp-upload-types span {
  color: #64748b;
  font-size: 12px;
}

.upload-command-bar {
  grid-template-columns: minmax(180px, 0.8fr) minmax(320px, 1.6fr) auto;
}

.material-recent-table,
.materials-table {
  min-width: 1080px;
}

.materials-table th:nth-child(1),
.materials-table td:nth-child(1) {
  width: 28%;
}

.materials-table th:nth-child(2),
.materials-table td:nth-child(2) {
  width: 80px;
}

.materials-table th:nth-child(3),
.materials-table td:nth-child(3) {
  width: 90px;
}

.materials-table th:nth-child(4),
.materials-table td:nth-child(4),
.materials-table th:nth-child(5),
.materials-table td:nth-child(5) {
  width: 120px;
}

.materials-table th:nth-child(6),
.materials-table td:nth-child(6) {
  width: 120px;
}

.materials-table th:nth-child(8),
.materials-table td:nth-child(8) {
  width: 150px;
}

.material-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.material-actions .btn {
  min-width: 54px;
  white-space: nowrap;
}

.material-detail-drawer {
  width: min(560px, calc(100vw - var(--sidebar-width)));
}

.ui-image-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ui-image-filter-bar {
  grid-template-columns: minmax(240px, 1.5fr) minmax(150px, 0.9fr) minmax(150px, 0.9fr) minmax(120px, 0.7fr) auto;
}

.ui-image-table {
  min-width: 1280px;
}

.ui-image-table th:nth-child(1),
.ui-image-table td:nth-child(1) {
  width: 86px;
}

.ui-image-table th:nth-child(2),
.ui-image-table td:nth-child(2) {
  width: 260px;
}

.ui-image-table th:nth-child(3),
.ui-image-table td:nth-child(3) {
  width: 130px;
  white-space: nowrap;
}

.ui-image-table th:nth-child(4),
.ui-image-table td:nth-child(4) {
  width: 180px;
}

.ui-image-table th:nth-child(5),
.ui-image-table td:nth-child(5) {
  width: 210px;
}

.ui-image-table th:nth-child(7),
.ui-image-table td:nth-child(7) {
  width: 220px;
}

.ui-image-table th:nth-child(8),
.ui-image-table td:nth-child(8) {
  width: 120px;
}

.ui-image-table th:nth-child(9),
.ui-image-table td:nth-child(9) {
  width: 120px;
}

.image-card.unsaved {
  background: #fffdf3;
}

.image-card.failed {
  background: #fff7f7;
}

.compact-input {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 6px 8px;
}

.ui-thumb-button {
  width: 58px;
  height: 58px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  padding: 2px;
  background: #fff;
  cursor: pointer;
}

.ui-thumb-button:hover {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ui-table-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.ui-image-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.ui-save-message {
  color: #475569;
  font-size: 13px;
}

.ui-save-message.success {
  color: var(--success);
}

.ui-save-message.error {
  color: var(--danger);
}

.card-error {
  margin-top: 5px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.35;
}

.ui-image-detail-drawer {
  width: min(620px, calc(100vw - var(--sidebar-width)));
}

.ui-preview-frame {
  display: grid;
  place-items: center;
  min-height: 320px;
  max-height: 480px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.ui-preview-frame img {
  width: 100%;
  height: 100%;
  max-height: 480px;
  object-fit: contain;
  display: block;
}

.drawer-edit-block {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.drawer-edit-block label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.execution-filter-bar {
  grid-template-columns: minmax(260px, 1.5fr) minmax(130px, 0.7fr) minmax(130px, 0.7fr) minmax(150px, 0.8fr) minmax(250px, 1.2fr) minmax(90px, 0.5fr) auto;
}

.date-range-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.date-range-inline span {
  color: var(--muted);
  font-size: 12px;
}

.execution-runs-table {
  min-width: 1320px;
}

.execution-runs-table th:nth-child(1),
.execution-runs-table td:nth-child(1) {
  width: 120px;
}

.execution-runs-table th:nth-child(2),
.execution-runs-table td:nth-child(2) {
  width: 150px;
}

.execution-runs-table th:nth-child(3),
.execution-runs-table td:nth-child(3) {
  width: 170px;
}

.execution-runs-table th:nth-child(4),
.execution-runs-table td:nth-child(4) {
  width: 210px;
}

.execution-runs-table th:nth-child(5),
.execution-runs-table td:nth-child(5) {
  width: 260px;
}

.execution-runs-table th:nth-child(6),
.execution-runs-table td:nth-child(6) {
  width: 150px;
}

.execution-runs-table th:nth-child(7),
.execution-runs-table td:nth-child(7) {
  width: 190px;
}

.execution-runs-table th:nth-child(8),
.execution-runs-table td:nth-child(8) {
  width: 90px;
}

.execution-runs-table th:nth-child(10),
.execution-runs-table td:nth-child(10) {
  width: 150px;
}

.execution-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.execution-run-drawer {
  width: min(560px, calc(100vw - var(--sidebar-width)));
}

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

.report-command-panel {
  display: grid;
  gap: 12px;
}

.report-ai-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
}

.report-ai-status.success {
  border-color: #bfe7d5;
  background: #f0fdf6;
}

.report-ai-status.warning {
  border-color: #fed7aa;
  background: #fff8ed;
}

.report-filter-bar {
  grid-template-columns: minmax(260px, 1.8fr) minmax(130px, 0.8fr) minmax(130px, 0.8fr) minmax(130px, 0.8fr) auto;
}

.report-create-panel {
  margin: 10px 0 12px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
}

.report-create-panel summary {
  cursor: pointer;
  padding: 10px 12px;
  color: #334155;
  font-weight: 800;
}

.report-create-panel[open] summary {
  border-bottom: 1px solid #dbe4ef;
}

.compact-form-grid {
  padding: 12px;
  margin: 0;
}

.report-ai-import {
  padding: 0 12px 12px;
}

.report-ai-import select {
  max-width: 420px;
}

.report-results-table {
  min-width: 1180px;
}

.report-results-table th:nth-child(1),
.report-results-table td:nth-child(1) {
  width: 110px;
}

.report-results-table th:nth-child(2),
.report-results-table td:nth-child(2) {
  width: 180px;
}

.report-results-table th:nth-child(3),
.report-results-table td:nth-child(3) {
  width: 90px;
}

.report-results-table th:nth-child(4),
.report-results-table td:nth-child(4),
.report-results-table th:nth-child(5),
.report-results-table td:nth-child(5) {
  width: 190px;
}

.report-results-table th:nth-child(7),
.report-results-table td:nth-child(7),
.report-results-table th:nth-child(8),
.report-results-table td:nth-child(8) {
  width: 110px;
}

.report-actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.report-detail-drawer {
  width: min(720px, calc(100vw - var(--sidebar-width)));
}

.report-evidence-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.report-evidence-preview strong {
  display: block;
  margin-bottom: 6px;
  color: #334155;
  font-size: 13px;
}

.report-evidence-frame {
  display: grid;
  place-items: center;
  min-height: 220px;
  max-height: 360px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.report-evidence-frame.empty::before {
  content: "暂无图片";
  color: var(--muted);
  font-size: 13px;
}

.report-evidence-frame.empty img {
  display: none;
}

.report-evidence-frame img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.ai-output-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ai-output-create-panel {
  margin: 0 0 12px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
}

.ai-output-create-panel summary {
  cursor: pointer;
  padding: 10px 12px;
  color: #334155;
  font-weight: 800;
}

.ai-output-create-panel[open] summary {
  border-bottom: 1px solid #dbe4ef;
}

.ai-output-filter-bar {
  grid-template-columns: minmax(280px, 1.8fr) minmax(170px, 0.9fr) minmax(140px, 0.8fr) auto;
}

.ai-output-table {
  min-width: 1240px;
}

.ai-output-table th:nth-child(1),
.ai-output-table td:nth-child(1) {
  width: 260px;
}

.ai-output-table th:nth-child(2),
.ai-output-table td:nth-child(2) {
  width: 150px;
}

.ai-output-table th:nth-child(3),
.ai-output-table td:nth-child(3),
.ai-output-table th:nth-child(4),
.ai-output-table td:nth-child(4) {
  width: 90px;
}

.ai-output-table th:nth-child(5),
.ai-output-table td:nth-child(5) {
  width: 160px;
}

.ai-output-table th:nth-child(6),
.ai-output-table td:nth-child(6) {
  width: 200px;
}

.ai-output-table th:nth-child(8),
.ai-output-table td:nth-child(8) {
  width: 240px;
}

.ai-output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ai-output-actions .inline-form {
  margin: 0;
}

.ai-output-drawer {
  width: min(780px, calc(100vw - var(--sidebar-width)));
}

.ai-output-edit-form {
  display: grid;
  gap: 12px;
}

.ai-output-edit-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-output-edit-form textarea {
  min-height: 360px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.ai-output-drawer-footer {
  padding: 0;
  border-top: 0;
}

.action-more {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.action-more summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.action-more summary::-webkit-details-marker {
  display: none;
}

.action-more summary::after {
  content: "⌄";
  margin-left: 6px;
  color: #64748b;
  font-size: 12px;
}

.action-more[open] summary {
  background: #eaf2ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.action-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 35;
  min-width: 190px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

.action-more-menu .btn {
  width: 100%;
  justify-content: flex-start;
}

@media (max-width: 1100px) {
  .erp-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench-layout {
    grid-template-columns: 1fr;
  }

  .workbench-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .workbench-action-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workbench-log-list .log-line {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .erp-summary-strip {
    grid-template-columns: 1fr;
  }

  .workbench-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .workbench-task-health,
  .workbench-kpi-grid,
  .workbench-alert-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench-last-run {
    grid-template-columns: 1fr;
  }

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

  .dashboard-filter-bar {
    grid-template-columns: 1fr;
  }

  .workbench-task-drawer {
    width: 100vw;
  }

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

  .drawer-log-line {
    grid-template-columns: 1fr;
  }

  .project-detail-drawer {
    width: 100vw;
  }

  .erp-upload-types,
  .upload-command-bar {
    grid-template-columns: 1fr;
  }

  .material-detail-drawer {
    width: 100vw;
  }
}

/* System settings: AI config first, provider table, right drawer, in-place test feedback. */
.settings-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.settings-hero h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

.settings-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.ai-config-center .panel-title-row,
.settings-provider-panel .panel-title-row {
  margin-bottom: 12px;
}

.settings-ai-summary {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.settings-ai-summary .ai-role-form {
  grid-column: span 4;
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid #d6e4ff;
  border-radius: 8px;
  background: #f8fbff;
}

.ai-role-select {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.ai-role-select span {
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.ai-role-select select {
  width: 100%;
}

.ai-role-select small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.ai-role-select em {
  color: #b45309;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.ai-role-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 2px;
}

.ai-role-actions span {
  color: #64748b;
  font-size: 12px;
}

.settings-ai-summary .ai-summary-card {
  min-height: 78px;
  padding: 12px 14px;
  border-color: #dbe4ef;
  background: #f8fbff;
}

.settings-ai-summary .ai-summary-card label {
  margin-bottom: 6px;
  color: #64748b;
  font-size: 12px;
}

.settings-ai-summary .ai-summary-card strong {
  font-size: 14px;
  line-height: 1.45;
  color: #111827;
}

.settings-provider-filter {
  grid-template-columns: minmax(260px, 1.5fr) minmax(140px, 0.8fr) minmax(180px, 0.9fr) auto;
  margin-top: 0;
}

.settings-provider-table {
  min-width: 1180px;
}

.settings-provider-table th:nth-child(1) {
  width: 190px;
}

.settings-provider-table th:nth-child(2) {
  width: 260px;
}

.settings-provider-table th:nth-child(5) {
  width: 210px;
}

.settings-provider-table th:nth-child(6) {
  width: 230px;
}

.settings-provider-table th:nth-child(7),
.settings-provider-table td:nth-child(7) {
  width: 118px;
  min-width: 118px;
}

.settings-provider-table tr {
  cursor: pointer;
}

.settings-provider-table .truncate-cell {
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-provider-actions {
  display: flex;
  gap: 8px;
  min-width: 150px;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 86px;
  min-height: 26px;
  padding: 3px 9px 3px 4px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.toggle-switch span,
.switch-check span {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 160ms ease;
}

.toggle-switch span::after,
.switch-check span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  transition: transform 160ms ease;
}

.toggle-switch.is-on {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.toggle-switch.is-on span,
.switch-check input:checked + span {
  background: #10b981;
}

.toggle-switch.is-on span::after,
.switch-check input:checked + span::after {
  transform: translateX(12px);
}

.toggle-switch:hover,
.switch-check:hover {
  border-color: #93b4ff;
  color: #1d4ed8;
}

.switch-check {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
}

.switch-check input {
  position: absolute;
  width: 1px !important;
  min-width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  opacity: 0;
  pointer-events: none;
}

.switch-check strong {
  color: inherit;
  font-size: 12px;
  font-weight: 900;
}

.global-ai-switch {
  min-width: 96px;
  border-color: #d6e4ff;
  background: #f8fbff;
}

.status-AVAILABLE,
.status-SUCCESS,
.status-ok {
  background: #ecfdf5;
  color: #047857;
}

.status-QUOTA_EXHAUSTED,
.status-AI_QUOTA_BLOCKED,
.status-TIMEOUT {
  background: #fffbeb;
  color: #b45309;
}

.status-FAILED,
.status-AUTH_FAILED,
.status-MODEL_NOT_FOUND,
.status-PARSE_ERROR,
.status-NETWORK_ERROR,
.status-IMAGE_TOO_SMALL {
  background: #fef2f2;
  color: #b91c1c;
}

.status-untested,
.status-new {
  background: #f1f5f9;
  color: #475569;
}

.settings-collapse {
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
}

.settings-collapse summary {
  cursor: pointer;
  padding: 12px 14px;
  color: #111827;
  font-size: 15px;
  font-weight: 800;
}

.settings-collapse[open] summary {
  border-bottom: 1px solid #e5eaf2;
  background: #f8fbff;
}

.settings-collapse form {
  padding: 14px;
}

.settings-form-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.settings-basic-table {
  min-width: 860px;
}

.settings-provider-drawer {
  width: min(880px, calc(100vw - var(--sidebar-width)));
  z-index: 70;
}

.settings-provider-drawer .detail-drawer-header {
  align-items: flex-start;
  padding: 18px 20px 14px;
}

.drawer-body {
  overflow: auto;
  padding: 18px 20px 24px;
}

.drawer-edit-form,
.drawer-model-form {
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
}

.provider-template-row {
  display: grid;
  grid-template-columns: minmax(220px, 320px);
  gap: 10px;
}

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

.drawer-form-grid label,
.provider-template-row label {
  display: grid;
  gap: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.drawer-wide {
  grid-column: 1 / -1;
}

.settings-drawer-secondary-actions {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 16px;
}

.provider-model-section {
  display: grid;
  gap: 10px;
}

.provider-model-section h3 {
  margin: 0;
}

#drawer-model-list {
  display: grid;
  gap: 12px;
}

.drawer-model-form {
  background: #f8fafc;
}

.drawer-model-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5eaf2;
}

.drawer-model-head strong {
  font-size: 15px;
  color: #0f172a;
}

.drawer-model-meta {
  padding: 8px 10px;
  border: 1px solid #e5eaf2;
  border-radius: 6px;
  background: #fff;
}

.settings-provider-drawer .ai-checkbox-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.settings-test-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.18);
}

.settings-test-card {
  min-width: 280px;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 22px 24px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #dbeafe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: settings-spin 0.8s linear infinite;
}

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

.settings-toast {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.16);
  cursor: pointer;
}

.settings-toast-card {
  position: relative;
  width: min(640px, 100%);
  max-height: min(76vh, 720px);
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  color: #111827;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  line-height: 1.55;
}

.settings-toast-card strong {
  font-size: 16px;
}

.settings-toast-card p {
  margin: 0;
}

.settings-toast-card small {
  color: #64748b;
}

.settings-toast-card .test-result-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.test-evidence-layout {
  display: grid;
  gap: 10px;
  margin: 6px 0;
}

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

.test-evidence-item {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
}

.test-evidence-item.wide {
  grid-column: 1 / -1;
}

.test-evidence-item span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.test-evidence-item strong,
.test-evidence-item a {
  min-width: 0;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.test-evidence-item a {
  color: #2563eb;
  text-decoration: none;
}

.test-evidence-item a:hover {
  text-decoration: underline;
}

.test-evidence-image {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
}

.test-evidence-image img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  background: #fff;
}

.test-evidence-image span {
  min-width: 0;
  color: #475569;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.test-response-preview {
  max-height: 150px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  background: #0f172a;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.settings-toast.success .settings-toast-card {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.settings-toast.error .settings-toast-card {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.test-ai-btn.is-loading,
#provider-drawer-test-btn.is-loading {
  cursor: wait;
}

@media (max-width: 1180px) {
  .settings-ai-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .settings-hero,
  .settings-provider-panel .panel-title-row,
  .ai-config-center .panel-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-ai-summary,
  .settings-provider-filter,
  .drawer-form-grid,
  .test-evidence-grid,
  .settings-provider-drawer .ai-checkbox-grid {
    grid-template-columns: 1fr;
  }

  .test-evidence-image {
    grid-template-columns: 1fr;
  }

  .settings-provider-drawer {
    width: 100vw;
  }
}

/* v0.7 test task list: ERP-style task dispatch page */
.task-list-page {
  display: grid;
  gap: 12px;
}

.task-list-page > * {
  min-width: 0;
}

.task-list-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 86px;
  padding: 16px 18px;
  border: 1px solid #dbe4ef;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.task-list-hero h2 {
  margin: 0 0 4px;
  color: #0f172a;
  font-size: 22px;
  font-weight: 900;
}

.task-list-hero p {
  max-width: 760px;
  margin: 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.7;
}

.task-list-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.task-list-summary button {
  min-width: 0;
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.task-list-summary button:hover,
.task-list-summary button:focus {
  border-color: #93c5fd;
  background: #f8fbff;
  outline: none;
}

.task-list-summary span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.task-list-summary strong {
  color: #1d4ed8;
  font-size: 22px;
  line-height: 1;
}

.task-list-panel {
  min-width: 0;
  margin-bottom: 0;
}

.task-list-title-row {
  margin-bottom: 12px;
}

.task-list-count {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid #dbe4ef;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.task-filter-bar {
  display: grid;
  grid-template-columns: minmax(280px, 1.6fr) minmax(180px, 0.8fr) minmax(150px, 0.75fr) minmax(150px, 0.75fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
}

.task-filter-bar label,
.task-pagination label {
  display: grid;
  gap: 5px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.task-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

.task-table-wrap {
  min-width: 0;
  border-color: #dbe4ef;
  box-shadow: inset 0 1px 0 #fff;
}

table.erp-table.task-list-table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.task-list-table th,
.task-list-table td {
  border-top: 0 !important;
  border-right: 0 !important;
  border-left: 0 !important;
  border-bottom: 1px solid #edf2f7 !important;
}

.task-list-table th {
  height: 40px;
  background: #f3f6fc;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.task-list-table td {
  height: 58px;
  background: #fff;
  color: #1f2937;
  font-size: 13px;
}

.task-list-table tbody tr:hover td {
  background: #f8fbff;
}

.task-list-table tbody tr.selected td {
  background: #eff6ff;
}

.task-list-table th:nth-child(1),
.task-list-table td:nth-child(1) {
  width: 46px;
  text-align: center;
}

.task-list-table th:nth-child(2),
.task-list-table td:nth-child(2) {
  width: 24%;
}

.task-list-table th:nth-child(3),
.task-list-table td:nth-child(3) {
  width: 18%;
}

.task-list-table th:nth-child(4),
.task-list-table td:nth-child(4) {
  width: 24%;
}

.task-list-table th:nth-child(5),
.task-list-table td:nth-child(5) {
  width: 132px;
}

.task-list-table th:nth-child(6),
.task-list-table td:nth-child(6) {
  width: 170px;
}

.task-list-table th:nth-child(7),
.task-list-table td:nth-child(7) {
  width: 96px;
}

.task-list-row {
  cursor: pointer;
}

.task-row-actions {
  white-space: nowrap;
  overflow: visible !important;
}

.task-row-actions .btn {
  min-width: 60px;
}

.task-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  color: #64748b;
  font-size: 13px;
}

.task-pagination .actions {
  gap: 8px;
}

.task-pagination select {
  min-width: 92px;
}

.task-detail-drawer {
  width: min(560px, calc(100vw - var(--sidebar-width)));
}

.task-drawer-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.task-drawer-link-grid .btn {
  justify-content: flex-start;
  background: #f8fafc;
  border-color: #dbe4ef;
}

.task-drawer-link-grid .btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

@media (max-width: 1180px) {
  .task-list-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .task-list-hero,
  .task-list-title-row,
  .task-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .task-list-summary,
  .task-filter-bar,
  .task-drawer-link-grid {
    grid-template-columns: 1fr;
  }

  .task-detail-drawer {
    width: 100vw;
  }
}

/* v0.7 task detail: remove legacy big flow line, use compact console layout */
.task-detail-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 92px;
  padding: 16px 18px;
  margin-bottom: 12px;
  border: 1px solid #dbe4ef;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.task-detail-hero h2 {
  margin: 0 0 6px;
  color: #0f172a;
  font-size: 20px;
  font-weight: 900;
}

.task-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.task-detail-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-detail-meta code {
  color: #334155;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}

.task-detail-hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 280px;
}

.task-progress-panel {
  padding-bottom: 14px;
}

.task-step-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.task-step-card {
  min-width: 0;
  min-height: 54px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #dbe4ef;
  border-left: 3px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  text-decoration: none;
}

.task-step-card:hover {
  border-color: #93c5fd;
  border-left-color: #2563eb;
  background: #f8fbff;
}

.task-step-card.done {
  border-left-color: #10b981;
  background: #fbfffd;
}

.task-step-card.active {
  border-color: #93c5fd;
  border-left-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 1px 8px rgba(37, 99, 235, 0.08);
}

.task-step-card.todo {
  color: #64748b;
  background: #fff;
}

.task-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.task-step-card.done .task-step-index {
  background: #d1fae5;
  color: #047857;
}

.task-step-card.active .task-step-index {
  background: #2563eb;
  color: #fff;
}

.task-step-main {
  min-width: 0;
  display: block;
}

.task-step-main strong {
  overflow: hidden;
  color: inherit;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-step-card em {
  min-width: 44px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.task-step-card.done em {
  background: #ecfdf5;
  color: #047857;
}

.task-step-card.active em {
  background: #dbeafe;
  color: #1d4ed8;
}

.task-run-panel .actions {
  margin-bottom: 10px;
}

.task-run-panel .notice {
  margin: 8px 0;
  padding: 9px 11px;
  font-size: 13px;
}

.task-run-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.task-run-summary .metric {
  min-height: 72px;
  padding: 12px 14px;
  border-color: #dbe4ef;
  box-shadow: none;
}

.task-run-summary .metric label {
  margin-bottom: 7px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.task-run-summary .metric strong {
  color: #1d4ed8;
  font-size: 20px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.task-stage-panel .table-wrap,
.task-stage-table {
  min-width: 0;
}

table.erp-table.task-stage-table {
  min-width: 980px;
  width: 100%;
  table-layout: fixed;
}

.task-stage-table th,
.task-stage-table td {
  border-top: 0 !important;
  border-right: 0 !important;
  border-left: 0 !important;
  border-bottom: 1px solid #edf2f7 !important;
}

.task-stage-table th {
  background: #f3f6fc;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.task-stage-table th:nth-child(1),
.task-stage-table td:nth-child(1) {
  width: 150px;
}

.task-stage-table th:nth-child(2),
.task-stage-table td:nth-child(2) {
  width: 110px;
}

.task-stage-table th:nth-child(5),
.task-stage-table td:nth-child(5) {
  width: 90px;
}

.status-stage-已完成 {
  background: #ecfdf5;
  color: #047857;
}

.status-stage-进行中 {
  background: #eff6ff;
  color: #1d4ed8;
}

.status-stage-阻塞,
.status-stage-异常 {
  background: #fef2f2;
  color: #b91c1c;
}

.status-stage-未开始 {
  background: #f1f5f9;
  color: #475569;
}

.task-count-panel {
  padding-bottom: 16px;
}

.task-count-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.task-count-grid div {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #f8fafc;
}

.task-count-grid span {
  display: block;
  margin-bottom: 6px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.task-count-grid strong {
  color: #0f172a;
  font-size: 20px;
  line-height: 1;
}

@media (max-width: 1180px) {
  .task-step-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .task-run-summary,
  .task-count-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .task-detail-hero,
  .task-detail-hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .task-detail-hero-actions {
    min-width: 0;
  }

  .task-run-summary,
  .task-count-grid,
  .task-step-grid {
    grid-template-columns: 1fr;
  }
}

/* v0.7 AI visual case generation console */
.ai-generation-hero {
  border-left: 4px solid #2563eb;
}

.ai-generation-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.ai-generation-config,
.ai-generation-console {
  margin-bottom: 12px;
}

.ai-generation-config {
  position: sticky;
  top: 66px;
}

.ai-generation-form {
  display: grid;
  gap: 12px;
}

.ai-generation-form label {
  display: grid;
  gap: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.ai-generation-form .checkbox-line {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.ai-generation-form .checkbox-line input {
  width: 16px;
  height: 16px;
}

.ai-generation-progress {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
}

.ai-generation-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #0f172a;
  font-size: 13px;
}

.ai-generation-progress-head strong {
  overflow-wrap: anywhere;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf2;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
  transition: width 0.25s ease;
}

.ai-generation-phase-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.ai-generation-phase-grid span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 6px;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  background: #fff;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.ai-generation-phase-grid b {
  color: #94a3b8;
  font-size: 10px;
}

.ai-generation-phase-grid span.done {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.ai-generation-phase-grid span.active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.ai-generation-evidence-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ai-generation-evidence-grid div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #fff;
}

.ai-generation-evidence-grid div.wide {
  grid-column: 1 / -1;
}

.ai-generation-evidence-grid div.wide {
  display: none;
}

.ai-generation-console::after {
  content: "请求、响应、解析文件路径保存在日志中；下方预览区直接查看生成的用例内容。";
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #dbeafe;
  border-radius: 7px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 12px;
  line-height: 1.45;
}

.ai-generation-evidence-grid span {
  display: block;
  margin-bottom: 5px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.ai-generation-evidence-grid strong {
  display: block;
  min-height: 18px;
  color: #0f172a;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.ai-generation-coverage {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.ai-generation-coverage[hidden] {
  display: none;
}

.ai-generation-coverage div {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #fff;
}

.ai-generation-coverage span {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.ai-generation-coverage strong {
  color: #1d4ed8;
  font-size: 18px;
}

.ai-generation-coverage p {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: #1e40af;
  font-size: 13px;
}

.ai-generation-result {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
}

.ai-generation-result.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.ai-generation-result.error {
  border-color: #fecaca;
  background: #fef2f2;
}

.ai-generation-result p {
  margin: 6px 0 10px;
  color: #475569;
}

.ai-generation-log-panel {
  margin-top: 0;
}

.ai-generation-log-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.ai-generation-log-line {
  display: grid;
  grid-template-columns: 160px 150px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid #e5eaf2;
  border-left: 3px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

.ai-generation-log-line.info {
  border-left-color: #2563eb;
}

.ai-generation-log-line.warn,
.ai-generation-log-line.warning {
  border-left-color: #d97706;
}

.ai-generation-log-line.error {
  border-left-color: #dc2626;
  background: #fffafa;
}

.ai-generation-log-line span {
  color: #64748b;
  font-size: 12px;
}

.ai-generation-log-line strong {
  color: #0f172a;
  font-size: 13px;
}

.ai-generation-log-line p {
  margin: 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.5;
}

.ai-generation-log-line pre {
  grid-column: 1 / -1;
  max-height: 240px;
  margin: 2px 0 0;
  padding: 8px 10px;
  overflow: auto;
  border-radius: 6px;
  background: #0f172a;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.45;
}

.ai-generation-suggestion-panel {
  margin-top: 0;
}

.ai-generation-suggestion-panel .panel-title-row {
  align-items: center;
}

.ai-generation-suggestion-panel .actions {
  min-width: min(520px, 100%);
}

.ai-generation-suggestion-panel .compact-input {
  min-width: 280px;
}

.ai-generation-suggestion-table {
  min-width: 1240px;
  table-layout: fixed;
}

.ai-generation-suggestion-table th:nth-child(1),
.ai-generation-suggestion-table td:nth-child(1) {
  width: 64px;
}

.ai-generation-suggestion-table th:nth-child(2),
.ai-generation-suggestion-table td:nth-child(2) {
  width: 260px;
}

.ai-generation-suggestion-table th:nth-child(3),
.ai-generation-suggestion-table td:nth-child(3) {
  width: 220px;
}

.ai-generation-suggestion-table th:nth-child(5),
.ai-generation-suggestion-table td:nth-child(5) {
  width: 90px;
}

.ai-generation-suggestion-table th:nth-child(6),
.ai-generation-suggestion-table td:nth-child(6) {
  width: 120px;
}

.ai-generation-suggestion-table th:nth-child(7),
.ai-generation-suggestion-table td:nth-child(7) {
  width: 100px;
}

.ai-generation-suggestion-table th:nth-child(8),
.ai-generation-suggestion-table td:nth-child(8) {
  width: 90px;
}

.ai-generation-suggestion-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-generation-suggestion-table tbody tr {
  cursor: pointer;
}

.ai-generation-suggestion-table tbody tr:hover td {
  background: #f8fbff;
}

.ai-generation-suggestion-drawer {
  width: min(760px, calc(100vw - var(--sidebar-width)));
}

.ai-generation-suggestion-drawer .inline-json {
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #0f172a;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 1280px) {
  .ai-generation-layout {
    grid-template-columns: 1fr;
  }

  .ai-generation-config {
    position: static;
  }

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

  .ai-generation-form button,
  .ai-generation-form .notice {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .ai-generation-form,
  .ai-generation-evidence-grid,
  .ai-generation-phase-grid {
    grid-template-columns: 1fr;
  }

  .ai-generation-log-line {
    grid-template-columns: 1fr;
  }
}

/* AI visual execution: compact console view */
.ai-console-context {
  margin-bottom: 10px;
  padding: 12px 16px;
}

.ai-console-context .task-context-main {
  display: block;
}

.ai-console-context .muted {
  max-width: 860px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-console-context .context-stats {
  justify-content: flex-start;
  gap: 6px;
  margin-top: 8px;
}

.ai-console-context .context-stats span {
  padding: 4px 8px;
  background: #f8fafc;
  white-space: nowrap;
}

.ai-command-panel-v2 {
  position: sticky;
  top: 54px;
  z-index: 22;
  margin-bottom: 10px;
  padding: 12px 16px;
}

.ai-command-head {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.ai-command-head h2 {
  margin: 0 0 6px;
  font-size: 16px;
}

.ai-command-head #run-message {
  margin: 0;
  padding: 7px 10px;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-command-panel-v2 .ai-command-actions {
  grid-column: auto;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.ai-command-panel-v2 .ai-command-actions .btn,
.ai-command-panel-v2 .more-menu > summary {
  min-height: 32px;
  padding: 6px 10px;
}

.ai-command-panel-v2 .ai-command-bar {
  grid-template-columns: minmax(210px, 1fr) minmax(100px, 0.4fr) minmax(150px, 0.65fr) minmax(145px, auto);
  gap: 8px;
  margin-top: 10px;
  align-items: end;
}

.ai-command-panel-v2 .ai-command-bar label {
  display: grid;
  gap: 4px;
}

.ai-command-panel-v2 .ai-checkbox-inline {
  display: inline-flex;
  align-self: end;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid #e5eaf2;
  border-radius: 6px;
  background: #f8fafc;
}

.ai-command-panel-v2 .ai-resume-strip {
  margin-top: 8px;
  padding: 7px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-run-dashboard {
  display: grid;
  grid-template-columns: minmax(155px, 0.45fr) minmax(360px, 1.25fr) minmax(270px, 0.85fr);
  gap: 10px;
  align-items: stretch;
  margin-bottom: 10px;
  padding: 12px;
}

.ai-run-status-tile,
.ai-run-progress-tile,
.ai-run-result-tile {
  min-width: 0;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px 12px;
}

.ai-run-status-tile {
  border-left: 4px solid #2563eb;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
}

.ai-run-status-tile span,
.ai-run-result-tile span,
.ai-run-progress-main span,
.ai-run-progress-sub span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.ai-run-status-tile strong {
  display: block;
  margin: 4px 0 3px;
  color: #1d4ed8;
  font-size: 20px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-run-status-tile small,
.ai-run-result-tile small {
  display: block;
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-run-progress-main {
  display: grid;
  grid-template-columns: minmax(110px, 0.75fr) minmax(150px, 1.05fr) minmax(70px, 0.45fr);
  gap: 8px;
}

.ai-run-progress-main > div {
  min-width: 0;
  padding: 0 10px;
  border-right: 1px solid #e5eaf2;
}

.ai-run-progress-main > div:last-child {
  border-right: 0;
}

.ai-run-progress-main strong {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-run-progress-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid #e5eaf2;
}

.ai-run-progress-sub strong {
  color: #0f172a;
}

.ai-run-result-tile strong {
  display: block;
  margin: 6px 0 4px;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-run-summary-compact {
  margin-bottom: 10px;
  padding: 14px 16px;
  background: #fff;
}

.ai-run-summary-compact .compact-row {
  margin-bottom: 8px;
}

.ai-run-summary-compact .run-summary-conclusion {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 8px 10px;
  line-height: 1.45;
}

.ai-run-summary-compact .run-summary-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.ai-run-summary-compact .run-summary-grid > div {
  padding: 7px 9px;
}

.ai-run-summary-compact .run-summary-grid span {
  margin-bottom: 3px;
}

.ai-run-summary-compact .run-summary-grid strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.run-summary-more,
.summary-reasons-details {
  margin-top: 8px;
}

.run-summary-more summary,
.summary-reasons-details summary {
  cursor: pointer;
  color: #2563eb;
  font-size: 13px;
  font-weight: 800;
}

.run-summary-more[open] .run-summary-reasons,
.summary-reasons-details[open] .run-summary-reasons {
  max-height: 110px;
  overflow: auto;
}

.ai-step-workbench {
  padding: 14px 16px;
}

.ai-step-workbench .panel-title-row {
  margin-bottom: 10px;
}

.ai-current-case-panel {
  padding: 14px 16px;
  margin-bottom: 10px;
}

.ai-current-case-panel .panel-title-row {
  margin-bottom: 8px;
}

.ai-current-case-focus {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(520px, 1.25fr);
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid #cfe0ff;
  border-left: 4px solid #2563eb;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.96), rgba(255, 255, 255, 0.98) 46%),
    #fff;
}

.case-focus-main {
  min-width: 0;
}

.case-focus-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
}

.case-focus-main h3 {
  margin: 9px 0 7px;
  color: #0f172a;
  font-size: 20px;
  font-weight: 950;
  line-height: 1.35;
  letter-spacing: 0;
}

.case-focus-main p {
  margin: 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.55;
}

.case-focus-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.case-focus-tags span {
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid #dbe4ef;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.proof-block {
  min-width: 0;
  min-height: 78px;
  padding: 10px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #fff;
}

.proof-block span {
  display: block;
  margin-bottom: 5px;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.proof-block strong {
  display: -webkit-box;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 850;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.proof-block.primary {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.proof-block.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.proof-block.info {
  border-color: #ddd6fe;
  background: #f5f3ff;
}

.proof-block.neutral {
  border-color: #e2e8f0;
  background: #f8fafc;
}

.ai-workbench-grid {
  grid-template-columns: minmax(220px, 280px) minmax(360px, 1.1fr) minmax(300px, 0.9fr);
  gap: 10px;
}

.ai-shot-pane,
.ai-chain-pane,
.ai-diagnosis-pane {
  padding: 10px;
}

.ai-shot-frame {
  min-height: 230px;
}

.ai-shot-frame img {
  max-height: 300px;
}

.ai-chain {
  gap: 7px;
}

.ai-chain-item {
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 9px;
}

.ai-chain-item strong {
  font-size: 13px;
  margin-bottom: 2px;
}

.ai-chain-item small {
  font-size: 12px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ai-diagnosis-list {
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 7px 8px;
}

.ai-diagnosis-list dd {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ai-perf-mini {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.ai-perf-mini span {
  padding: 6px 7px;
}

.ai-bottom-grid {
  gap: 10px;
}

@media (max-width: 980px) {
  .ai-command-head,
  .ai-run-dashboard,
  .ai-current-case-focus {
    grid-template-columns: 1fr;
  }

  .ai-command-panel-v2 .ai-command-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .ai-command-panel-v2 .ai-command-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ai-command-panel-v2 .ai-checkbox-inline {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 820px) {
  .ai-run-progress-main,
  .ai-workbench-grid,
  .ai-run-summary-compact .run-summary-grid,
  .case-focus-proof,
  .ai-run-detail-panel .drawer-tab-panel.active[data-ai-drawer-panel="overview"] {
    grid-template-columns: 1fr;
  }

  .ai-run-detail-modal {
    padding: 10px;
  }

  .ai-run-detail-panel {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .ai-run-progress-main > div {
    border-right: 0;
    border-bottom: 1px solid #e5eaf2;
    padding: 0 0 8px;
  }

  .ai-run-progress-main > div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }
}

/* v0.8 ERP polish pass: global shell, dense lists, clearer hierarchy */
:root {
  --sidebar-width: 228px;
  --bg: #f3f6fb;
  --panel: #ffffff;
  --line: #dbe3ef;
  --line-soft: #edf2f7;
  --text: #172033;
  --muted: #66758a;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-weak: #eaf2ff;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --neutral: #64748b;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.app-shell {
  background: var(--bg);
}

.sidebar {
  background: #ffffff;
  color: #334155;
  border-right: 1px solid #dce4ef;
  padding: 18px 14px;
  box-shadow: 2px 0 10px rgba(15, 23, 42, 0.03);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 2px 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.22;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: #2563eb;
  color: #fff;
  font-size: 15px;
  letter-spacing: 0;
}

.sidebar-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  font-size: 18px;
}

.sidebar-toggle:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #eff6ff;
}

.nav {
  gap: 2px;
}

.nav-group-label {
  margin: 18px 8px 7px;
  color: #7b8ba1;
  font-size: 12px;
  font-weight: 800;
}

.nav a,
.nav-disabled-link {
  min-height: 36px;
  display: flex;
  align-items: center;
  border-radius: 7px;
  padding: 8px 10px;
  color: #44546a;
  font-size: 14px;
  font-weight: 700;
}

.nav a:hover,
.nav a.active {
  background: #eaf2ff;
  color: #1d4ed8;
}

.nav a.active {
  box-shadow: inset 3px 0 0 #2563eb;
}

.nav-disabled-label span {
  color: #94a3b8;
}

.nav-disabled-link {
  color: #a3adba;
  background: transparent;
}

.nav-disabled-link:hover,
.nav-disabled-link:focus {
  background: #f1f5f9;
  color: #64748b;
}

body.sidebar-collapsed {
  --sidebar-width: 72px;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .nav a,
body.sidebar-collapsed .nav-disabled-link {
  font-size: 0;
}

body.sidebar-collapsed .nav a::after,
body.sidebar-collapsed .nav-disabled-link::after {
  content: attr(data-short);
  font-size: 12px;
  font-weight: 900;
}

body.sidebar-collapsed .brand {
  justify-content: center;
}

body.sidebar-collapsed .sidebar-toggle {
  display: none;
}

.main {
  background: var(--bg);
}

.topbar {
  height: 56px;
  padding: 0 28px;
  border-bottom: 1px solid #dce4ef;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  color: #0f172a;
  font-size: 18px;
  font-weight: 900;
}

.topbar span {
  color: #64748b;
  font-size: 13px;
}

.content {
  padding: 16px 22px 34px;
}

.panel,
.task-context-bar,
.workbench-top,
.task-list-hero,
.task-detail-hero {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.panel {
  padding: 16px 18px;
  margin-bottom: 12px;
}

.panel-title-row {
  margin-bottom: 12px;
}

.panel h2,
.task-context-main h2,
.task-list-hero h2,
.workbench-top h2 {
  margin: 0 0 5px;
  color: #0f172a;
  font-size: 18px;
  font-weight: 900;
}

.breadcrumb {
  margin-bottom: 6px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.muted {
  color: #64748b;
  font-size: 13px;
  line-height: 1.55;
}

.btn {
  min-height: 32px;
  border-radius: 6px;
  padding: 6px 11px;
  border-color: #dbe4ef;
  background: #f3f6fb;
  color: #172033;
  font-size: 13px;
  font-weight: 800;
  box-shadow: none;
}

.btn:hover {
  border-color: #b6c4d8;
  background: #eaf0f8;
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-hover);
}

.btn.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.btn.small,
.btn.sm {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

input,
select,
textarea {
  min-height: 32px;
  border-color: #d6e0ec;
  border-radius: 6px;
  background: #fff;
  padding: 7px 10px;
  color: #172033;
  font-size: 13px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.16);
  border-color: #60a5fa;
}

.notice {
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 13px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: auto;
}

table.erp-table,
.erp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.erp-table th,
.erp-table td,
th,
td {
  border-top: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 1px solid var(--line-soft);
}

.erp-table th,
th {
  height: 38px;
  padding: 8px 10px;
  background: #f3f6fb;
  color: #44546a;
  font-size: 12px;
  font-weight: 900;
}

.erp-table td,
td {
  padding: 9px 10px;
  color: #1f2a3d;
  font-size: 13px;
  line-height: 1.45;
}

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

.cell-strong {
  color: #111827;
  font-weight: 900;
}

.cell-muted {
  color: #64748b;
  font-size: 12px;
}

.status,
.status-pill {
  min-width: auto;
  min-height: 22px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.status.success,
.status.done,
.status-REPORT_READY,
.status-SUCCESS,
.status-DONE,
.status-COMPLETED,
.status-LINKED {
  background: #ecfdf5;
  color: #047857;
}

.status.warning,
.status-PENDING_CONFIRM,
.status-REVIEW,
.status-PARTIAL_SUCCESS {
  background: #fffbeb;
  color: #b45309;
}

.status.danger,
.status-FAILED,
.status-ERROR,
.status-BLOCKED,
.status-TIMEOUT {
  background: #fef2f2;
  color: #b91c1c;
}

.status-primary,
.status-AI_VISUAL_RUNNING,
.status-RUNNING,
.status-REQUESTING {
  background: #eff6ff;
  color: #1d4ed8;
}

.erp-client-pagination,
.erp-pagination,
.task-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 2px 0;
  color: #64748b;
  font-size: 13px;
}

.erp-pager-total {
  margin-right: auto;
}

.erp-pager-total strong {
  color: #0f172a;
}

.erp-pager-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.erp-pager-size select {
  width: 112px;
  min-height: 32px;
}

.erp-pager-current {
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #2563eb;
  font-weight: 900;
}

.erp-pager-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.erp-pager-jump input {
  width: 64px;
  text-align: center;
}

.modal-close-btn {
  width: 34px;
  height: 34px;
  min-height: 34px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
  color: #1f2937;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  padding: 0;
}

.modal-close-btn:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.detail-drawer {
  width: min(720px, calc(100vw - var(--sidebar-width)));
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgba(15, 23, 42, 0.13);
}

.detail-drawer-header {
  padding: 16px 20px 12px;
}

.drawer-body {
  padding: 14px 20px;
}

.drawer-footer {
  padding: 12px 20px;
}

/* Workbench */
.workbench-top.compact,
.task-list-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  margin-bottom: 12px;
  border-left: 4px solid #2563eb;
}

.workbench-alert-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.workbench-alert-chip {
  min-height: 74px;
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid #94a3b8;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.workbench-alert-chip strong {
  color: #0f172a;
  font-size: 24px;
  line-height: 1;
}

.workbench-alert-chip span {
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.workbench-alert-chip small {
  color: #64748b;
  font-size: 12px;
}

.workbench-alert-chip.primary {
  border-left-color: #2563eb;
}

.workbench-alert-chip.warning {
  border-left-color: #d97706;
}

.workbench-alert-chip.danger {
  border-left-color: #dc2626;
}

.workbench-task-panel .table-wrap,
.task-list-panel .table-wrap {
  max-height: calc(100vh - 330px);
}

.workbench-task-table,
.task-list-table {
  min-width: 1120px;
}

.workbench-task-actions,
.task-row-actions {
  white-space: nowrap;
}

.dashboard-filter-bar,
.task-filter-bar,
.erp-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
  margin: 10px 0 12px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.dashboard-filter-bar label,
.task-filter-bar label,
.erp-filter-bar label {
  display: grid;
  gap: 5px;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

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

.task-list-summary button {
  min-height: 64px;
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
}

.task-list-summary button:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.task-list-summary span {
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.task-list-summary strong {
  color: #0f172a;
  font-size: 22px;
}

.task-selection-bar {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 10px;
  color: #64748b;
  font-size: 13px;
}

.task-pagination .actions {
  gap: 8px;
}

.task-pagination label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 13px;
}

.task-pagination select {
  width: 94px;
}

.drawer-metric-grid,
.task-drawer-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.drawer-metric-grid div {
  padding: 10px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #f8fafc;
}

.drawer-metric-grid span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.drawer-metric-grid strong {
  display: block;
  margin-top: 5px;
  color: #0f172a;
  font-size: 20px;
}

/* AI case generation */
.ai-generation-layout {
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 12px;
}

.ai-generation-config {
  top: 70px;
}

.ai-generation-form {
  gap: 10px;
}

.ai-generation-form select[multiple] {
  min-height: 132px;
}

.ai-generation-console {
  min-width: 0;
}

.ai-generation-progress {
  margin-bottom: 10px;
  padding: 10px;
}

.ai-generation-phase-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
}

.ai-generation-phase-grid span {
  min-height: 28px;
  justify-content: flex-start;
  padding: 4px 7px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ai-generation-evidence-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ai-generation-evidence-grid div {
  padding: 8px 10px;
}

.ai-generation-result {
  margin-top: 10px;
  padding: 12px 14px;
}

.ai-generation-suggestion-panel .panel-title-row {
  gap: 12px;
}

.ai-generation-suggestion-panel .actions {
  flex-wrap: nowrap;
}

.ai-generation-suggestion-table {
  min-width: 1180px;
}

.ai-generation-log-list {
  max-height: 360px;
}

.ai-generation-log-line {
  grid-template-columns: 145px 138px minmax(0, 1fr);
  padding: 8px 10px;
}

/* AI visual execution: reduce length and surface active work */
.ai-console-context,
.ai-command-panel-v2,
.ai-run-dashboard,
.ai-run-summary-compact,
.ai-step-workbench {
  border-radius: 8px;
}

.ai-command-panel-v2 {
  top: 56px;
  padding: 11px 14px;
}

.ai-command-panel-v2 .ai-command-bar {
  grid-template-columns: minmax(230px, 1fr) minmax(150px, 0.5fr) minmax(170px, auto);
}

.ai-run-dashboard {
  grid-template-columns: minmax(190px, 0.55fr) minmax(420px, 1.25fr) minmax(300px, 0.8fr);
  padding: 10px;
}

.ai-run-status-tile,
.ai-run-progress-tile,
.ai-run-result-tile {
  padding: 9px 10px;
}

.ai-run-status-tile strong,
.ai-run-result-tile strong,
.ai-run-progress-main strong {
  font-size: 16px;
}

.ai-run-summary-compact .run-summary-conclusion {
  -webkit-line-clamp: 2;
}

.ai-step-workbench {
  padding: 12px 14px;
}

.ai-workbench-grid {
  grid-template-columns: minmax(210px, 260px) minmax(380px, 1.15fr) minmax(280px, 0.85fr);
}

.ai-shot-frame {
  min-height: 210px;
}

.ai-shot-frame img {
  max-height: 280px;
}

.ai-bottom-grid {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
}

@media (max-width: 1280px) {
  .workbench-alert-strip,
  .task-list-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-filter-bar,
  .task-filter-bar,
  .erp-filter-bar,
  .ai-generation-layout,
  .ai-run-dashboard,
  .ai-workbench-grid,
  .ai-bottom-grid {
    grid-template-columns: 1fr;
  }

  .ai-generation-config {
    position: static;
  }
}

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

  .workbench-top.compact,
  .task-list-hero,
  .task-context-main,
  .panel-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .workbench-alert-strip,
  .task-list-summary,
  .dashboard-filter-bar,
  .task-filter-bar,
  .erp-filter-bar,
  .ai-generation-evidence-grid,
  .ai-generation-phase-grid {
    grid-template-columns: 1fr;
  }

  .detail-drawer {
    width: 100vw;
  }
}

/* v0.8.1 AI generation: keep console visible on normal desktop widths */
@media (min-width: 1100px) {
  .ai-generation-layout {
    grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
  }

  .ai-generation-form {
    align-items: start;
  }

  .ai-generation-form label {
    align-content: start;
  }

  #generate-scope,
  #duplicate-strategy,
  #default-priority {
    height: 34px;
    min-height: 34px;
  }
}

.ai-generation-form select[multiple] {
  min-height: 126px;
  max-height: 160px;
}

/* v0.8.2 global ERP visual pass: final layer wins over older legacy rules */
:root {
  --sidebar-width: 220px;
  --bg: #f3f6fb;
  --panel: #ffffff;
  --line: #d9e2ef;
  --line-soft: #edf2f7;
  --text: #172033;
  --muted: #667085;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-weak: #eaf2ff;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --neutral: #64748b;
}

body {
  min-width: 1180px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.sidebar {
  width: var(--sidebar-width);
  padding: 16px 12px;
  background: #ffffff;
  color: #334155;
  border-right: 1px solid var(--line);
  box-shadow: 1px 0 0 rgba(15, 23, 42, 0.02);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}

.brand-text {
  display: inline-block;
}

.sidebar-toggle {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #475569;
  cursor: pointer;
}

.nav {
  display: grid;
  gap: 2px;
}

.nav-group-label {
  margin: 18px 10px 6px;
  color: #7b8798;
  font-size: 12px;
  font-weight: 900;
}

.nav a,
.nav-disabled-link {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 7px;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
}

.nav a.active {
  color: #1d4ed8;
  background: #dbeafe;
  box-shadow: inset 3px 0 0 #2563eb;
}

.nav a:hover,
.nav-disabled-link:hover,
.nav-disabled-link:focus {
  color: #1d4ed8;
  background: #eff6ff;
}

.nav a.nav-advanced-link {
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

.nav a.nav-advanced-link::after {
  content: "可选";
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 900;
}

.nav a.nav-advanced-link.active {
  color: #2563eb;
  background: #eef5ff;
  box-shadow: inset 3px 0 0 #93b4ff;
}

body.sidebar-collapsed .nav a.nav-advanced-link::after {
  display: none;
}

.nav-disabled-link {
  background: transparent;
  color: #a0aec0;
}

.nav-disabled-label span {
  color: #94a3b8;
}

.main {
  margin-left: var(--sidebar-width);
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  height: 56px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar h1 {
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
}

.topbar span {
  color: #64748b;
  font-size: 13px;
}

.content {
  padding: 16px 24px 36px;
}

.panel,
.metric,
.item-card,
.task-context-bar,
.workbench-top.compact,
.task-list-hero,
.ai-console-context,
.ai-command-panel-v2,
.ai-run-dashboard,
.ai-run-summary-compact,
.ai-step-workbench {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.panel {
  padding: 16px 18px;
  margin-bottom: 14px;
}

.panel h2,
.panel h3 {
  margin: 0 0 10px;
  color: #111827;
  font-weight: 900;
}

.panel h2 {
  font-size: 18px;
}

.panel h3 {
  font-size: 15px;
}

.panel-title-row {
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.muted {
  color: #667085;
  font-size: 13px;
}

.actions {
  gap: 8px;
}

.btn {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #d8dee9;
  background: #f3f6fb;
  color: #172033;
  font-size: 13px;
  font-weight: 800;
  box-shadow: none;
}

.btn:hover:not(:disabled) {
  border-color: #b7c6dc;
  background: #eaf0f8;
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.btn.small {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 12px;
}

.btn.icon {
  width: 30px;
  padding: 0;
}

input,
select,
textarea {
  min-height: 32px;
  padding: 6px 9px;
  border-radius: 6px;
  border-color: #d8dee9;
  background: #fff;
  color: #172033;
  -webkit-text-fill-color: #172033;
  font-size: 13px;
}

input:hover:not(:disabled):not([readonly]),
select:hover:not(:disabled),
textarea:hover:not(:disabled):not([readonly]) {
  border-color: #b8c7dc;
  background-color: #fff;
  color: #172033;
  -webkit-text-fill-color: #172033;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #93b4ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background-color: #fff;
  color: #172033;
  -webkit-text-fill-color: #172033;
}

select option,
select optgroup {
  background-color: #fff;
  color: #172033;
}

select option:hover,
select option:focus {
  background-color: #eaf2ff;
  color: #172033;
}

select option:checked {
  background-color: #dbeafe;
  color: #172033;
}

select:disabled,
input:disabled,
textarea:disabled {
  background-color: #f1f5f9;
  color: #94a3b8;
  -webkit-text-fill-color: #94a3b8;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  margin: 0;
  box-shadow: none;
  vertical-align: middle;
}

.checkbox-label,
.checkbox-line,
.ai-checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ai-command-panel-v2 .ai-checkbox-inline {
  align-self: end;
  width: auto;
  min-height: 32px;
  padding: 0 10px;
}

.ai-command-panel-v2 .ai-command-bar {
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 0.7fr) minmax(160px, auto) auto auto;
  align-items: end;
}

.ai-command-panel-v2 .ai-command-bar label.ai-checkbox-inline {
  display: inline-flex;
  justify-content: flex-start;
  width: max-content;
  max-width: 220px;
  white-space: nowrap;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: auto;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f4f7fb;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

tr:hover td {
  background: #f8fbff;
}

.status,
.status-pill {
  min-width: auto;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status {
  color: #fff;
}

.metric {
  min-height: auto;
  padding: 14px 16px;
}

.metric label {
  margin: 0 0 6px;
  color: #667085;
  font-size: 13px;
}

.metric strong {
  color: #1d4ed8;
  font-size: 24px;
}

.notice,
.alert,
.global-job-bar {
  border-radius: 8px;
}

.erp-filter-bar,
.dashboard-filter-bar,
.task-filter-bar {
  padding: 10px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #f8fafc;
}

.erp-bulk-toolbar {
  top: 56px;
  border-color: #d6e4ff;
  background: #f8fbff;
}

.erp-pagination,
.erp-client-pagination,
.task-pagination,
.pagination-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: #64748b;
  font-size: 13px;
}

.erp-pager-total {
  margin-right: auto;
}

.erp-pager-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.erp-pager-size select {
  width: 100px;
}

.erp-pager-current {
  min-width: 28px;
  text-align: center;
  color: #2563eb;
  font-weight: 900;
}

.erp-pager-jump input {
  width: 64px;
  text-align: center;
}

.detail-drawer {
  width: min(760px, calc(100vw - var(--sidebar-width)));
  box-shadow: -12px 0 28px rgba(15, 23, 42, 0.16);
}

.detail-drawer-header {
  padding: 16px 18px 12px;
}

.drawer-body {
  padding: 14px 18px;
}

.drawer-footer {
  padding: 10px 18px;
}

.modal-card,
.modal-content,
.dialog-card {
  border-radius: 10px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.22);
}

.modal-close,
.drawer-close,
.close-btn,
button[aria-label="关闭"] {
  min-width: 32px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.run-step-card,
.compact-step-card,
.ai-generation-log-line {
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #fff;
}

.run-step-card:hover,
.compact-step-card:hover {
  border-color: #93b4ff;
  background: #f8fbff;
}

.code-box,
pre,
code {
  font-family: Consolas, "Cascadia Mono", "Microsoft YaHei", monospace;
}

.code-box {
  min-height: 160px;
  padding: 14px;
  border-radius: 8px;
}

@media (max-width: 1280px) {
  body {
    min-width: 1024px;
  }
}

/* AI visual run: keep step list usable while the detail panel is open. */
@media (min-width: 1281px) {
  body.ai-run-detail-open .main {
    padding-right: min(780px, calc(100vw - var(--sidebar-width) - 360px));
    transition: padding-right 160ms ease;
  }

  body.ai-run-detail-open .ai-run-drawer {
    width: min(760px, calc(100vw - var(--sidebar-width) - 360px));
  }

  body.ai-run-detail-open .run-step-card,
  body.ai-run-detail-open .compact-step-card {
    max-width: 100%;
  }
}

@media (max-width: 1280px) {
  body.ai-run-detail-open .ai-run-drawer {
    width: 100vw;
  }
}

/* 2026-06-12: final global form-control readability pass.
   Keep every native input/select readable on hover, focus, selected and dynamic rows. */
:root {
  --field-bg: #ffffff;
  --field-bg-hover: #f8fbff;
  --field-bg-focus: #ffffff;
  --field-border: #cfd8e6;
  --field-border-hover: #93b4ff;
  --field-border-focus: #2563eb;
  --field-text: #172033;
  --field-muted: #64748b;
  --field-option-hover: #eaf2ff;
  --field-option-selected: #dbeafe;
  --field-disabled-bg: #f1f5f9;
  --field-disabled-text: #94a3b8;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea {
  box-sizing: border-box;
  min-height: 34px;
  border: 1px solid var(--field-border) !important;
  border-radius: 7px;
  background-color: var(--field-bg) !important;
  color: var(--field-text) !important;
  -webkit-text-fill-color: var(--field-text) !important;
  caret-color: var(--field-text);
  box-shadow: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

select:not([multiple]):not([size]) {
  padding-right: 30px;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%),
    linear-gradient(to right, #e2e8f0, #e2e8f0);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%,
    calc(100% - 30px) 50%;
  background-size: 5px 5px, 5px 5px, 1px 18px;
  background-repeat: no-repeat;
}

select[multiple],
select[size]:not([size="1"]) {
  min-height: 92px;
  padding: 6px;
  overflow: auto;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):hover:not(:disabled):not([readonly]),
select:hover:not(:disabled),
textarea:hover:not(:disabled):not([readonly]) {
  border-color: var(--field-border-hover) !important;
  background-color: var(--field-bg-hover) !important;
  color: var(--field-text) !important;
  -webkit-text-fill-color: var(--field-text) !important;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
select:focus,
textarea:focus {
  outline: none !important;
  border-color: var(--field-border-focus) !important;
  background-color: var(--field-bg-focus) !important;
  color: var(--field-text) !important;
  -webkit-text-fill-color: var(--field-text) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14) !important;
}

select option,
select optgroup {
  min-height: 28px;
  padding: 7px 10px;
  background-color: #fff !important;
  color: var(--field-text) !important;
  -webkit-text-fill-color: var(--field-text) !important;
}

select option:hover,
select option:focus,
select option:active {
  background: var(--field-option-hover) !important;
  box-shadow: 0 0 0 100vmax var(--field-option-hover) inset !important;
  color: var(--field-text) !important;
  -webkit-text-fill-color: var(--field-text) !important;
}

select option:checked,
select option:checked:hover,
select option:checked:focus {
  background: linear-gradient(0deg, var(--field-option-selected), var(--field-option-selected)) !important;
  box-shadow: 0 0 0 100vmax var(--field-option-selected) inset !important;
  color: var(--field-text) !important;
  -webkit-text-fill-color: var(--field-text) !important;
  font-weight: 800;
}

select:disabled,
input:disabled,
textarea:disabled {
  border-color: #dbe3ee !important;
  background-color: var(--field-disabled-bg) !important;
  color: var(--field-disabled-text) !important;
  -webkit-text-fill-color: var(--field-disabled-text) !important;
  cursor: not-allowed;
  opacity: 1;
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8 !important;
  -webkit-text-fill-color: #94a3b8 !important;
}

input[type="file"] {
  min-height: 36px;
  padding: 5px;
  background: #fff !important;
}

input[type="file"]::file-selector-button {
  min-height: 26px;
  margin-right: 10px;
  padding: 4px 10px;
  border: 1px solid #cfd8e6;
  border-radius: 6px;
  background: #f3f7fd;
  color: #172033;
  font-weight: 800;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  border-color: #93b4ff;
  background: #eaf2ff;
  color: #1d4ed8;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: #2563eb;
}

.erp-filter-bar input,
.erp-filter-bar select,
.erp-filter-bar textarea,
.drawer-form-grid input,
.drawer-form-grid select,
.drawer-form-grid textarea,
.form-grid input,
.form-grid select,
.form-grid textarea,
.compact-form-grid input,
.compact-form-grid select,
.compact-form-grid textarea,
.case-table input,
.case-table select,
.case-table textarea,
.ai-generation-form input,
.ai-generation-form select,
.ai-generation-form textarea,
.report-ai-import select,
.erp-pagination select,
.erp-client-pagination select,
.task-pagination select,
.pagination-row select {
  width: 100%;
}

.erp-filter-bar label,
.drawer-form-grid label,
.form-grid label,
.compact-form-grid label {
  color: #334155;
}

.erp-filter-bar select,
.erp-client-pagination select,
.task-pagination select,
.pagination-row select,
.ai-role-select select {
  min-width: 0;
}

.case-table select,
._visual-cases-row select,
select[data-relation-type],
#selected-pages,
#design-match-detail-page-size,
#rule-match-detail-page-size {
  color: var(--field-text) !important;
  -webkit-text-fill-color: var(--field-text) !important;
}

.form-help,
.field-help,
.cell-muted,
.muted {
  color: #64748b;
}

/* 2026-06-12: global ERP polish pass.
   This layer is intentionally broad but conservative: it tightens density,
   visual hierarchy, tables, filters, drawers and modal affordances without
   changing page data contracts. */
:root {
  --app-bg: #eef2f7;
  --panel-bg: #ffffff;
  --panel-border: #dbe3ef;
  --panel-border-strong: #c8d5e6;
  --panel-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  --panel-shadow-hover: 0 8px 22px rgba(15, 23, 42, 0.08);
  --nav-text: #334155;
  --nav-muted: #8492a6;
  --brand-blue: #2563eb;
  --brand-blue-weak: #eaf2ff;
  --success-bg: #eafaf1;
  --success-text: #047857;
  --warning-bg: #fff7e6;
  --warning-text: #b45309;
  --danger-bg: #fff1f2;
  --danger-text: #be123c;
  --info-bg: #eff6ff;
  --info-text: #1d4ed8;
}

body {
  background:
    linear-gradient(180deg, #f8fafc 0, var(--app-bg) 180px),
    var(--app-bg);
  color: #172033;
}

.main {
  padding: 16px 18px 28px;
}

.topbar {
  min-height: 54px;
  border-bottom: 1px solid #dbe3ef;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.topbar h1,
.page-title,
.task-context-main h2,
.panel h2 {
  letter-spacing: 0;
}

.sidebar {
  border-right: 1px solid #d8e2f0;
  background: #ffffff;
  box-shadow: 1px 0 0 rgba(15, 23, 42, 0.02);
}

.brand-row {
  min-height: 64px;
  border-bottom: 1px solid #edf2f7;
}

.brand-mark {
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.nav {
  padding: 14px 10px 22px;
}

.nav a,
.nav-disabled-link {
  min-height: 36px;
  border-radius: 7px;
  color: var(--nav-text);
  font-weight: 750;
}

.nav a:hover {
  background: #f3f7fd;
  color: #1d4ed8;
}

.nav a.active {
  background: #dbeafe;
  color: #1d4ed8;
  box-shadow: inset 3px 0 0 #2563eb;
}

.nav-group-label {
  margin: 16px 8px 6px;
  color: var(--nav-muted);
  font-size: 12px;
  font-weight: 900;
}

.panel,
.task-context-bar,
.page-hero,
.dashboard-section,
.project-summary-card,
.task-summary-card,
.settings-card,
.ai-generation-console,
.ai-generation-config,
.ai-generation-suggestion-panel,
.ai-generation-log-panel,
.run-summary-card,
.card {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: var(--panel-shadow);
}

.panel,
.task-context-bar,
.page-hero {
  margin-bottom: 12px;
  padding: 14px 16px;
}

.panel:hover,
.task-context-bar:hover,
.page-hero:hover {
  border-color: var(--panel-border-strong);
}

.panel-title-row,
.task-context-main,
.page-head,
.section-head,
.table-toolbar,
.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title-row h2,
.task-context-main h2,
.page-head h2,
.section-head h2 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  font-weight: 900;
}

.panel-title-row .muted,
.task-context-main .muted,
.breadcrumb,
.page-subtitle {
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}

.breadcrumb {
  margin-bottom: 6px;
  font-weight: 700;
}

.actions,
.button-row,
.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn,
button,
input[type="submit"] {
  border-radius: 7px;
  font-weight: 850;
  letter-spacing: 0;
}

.btn {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #d7e0ee;
  background: #f6f8fb;
  color: #172033;
}

.btn:hover:not(:disabled) {
  border-color: #adc5ff;
  background: #edf4ff;
  color: #1d4ed8;
}

.btn.primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.16);
}

.btn.primary:hover:not(:disabled) {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #ffffff;
}

.btn.danger {
  border-color: #dc2626;
  background: #dc2626;
  color: #ffffff;
}

.btn:disabled,
button:disabled {
  opacity: 1;
  border-color: #dbe3ee !important;
  background: #eef3f8 !important;
  color: #94a3b8 !important;
  cursor: not-allowed;
  box-shadow: none !important;
}

.btn.small,
.btn.sm {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.btn.icon {
  width: 30px;
  min-width: 30px;
  padding: 0;
  font-size: 16px;
}

.erp-filter-bar,
.dashboard-filter-bar,
.task-filter-bar,
.filter-bar,
.search-panel,
.compact-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid #dfe7f2;
  border-radius: 8px;
  background: #f8fafc;
}

.erp-filter-bar label,
.dashboard-filter-bar label,
.task-filter-bar label,
.filter-bar label,
.search-panel label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.table-wrap,
.erp-table-wrap {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  overflow: auto;
}

.erp-table,
.table-wrap table,
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.erp-table th,
.erp-table td,
.table-wrap th,
.table-wrap td,
table th,
table td {
  padding: 9px 11px;
  border-bottom: 1px solid #e8eef6;
  vertical-align: middle;
}

.erp-table th,
.table-wrap th,
table th {
  top: 0;
  z-index: 3;
  background: #f1f5fb;
  color: #475569;
  font-size: 12px;
  font-weight: 950;
}

.erp-table tbody tr:nth-child(even) td,
.table-wrap tbody tr:nth-child(even) td {
  background-color: #fcfdff;
}

.erp-table tbody tr:hover td,
.table-wrap tbody tr:hover td,
table tbody tr:hover td {
  background: #f2f7ff;
}

.erp-table td:first-child,
.erp-table th:first-child,
.table-wrap td:first-child,
.table-wrap th:first-child {
  border-left: 0;
}

.empty-state,
.empty-row td,
.table-empty {
  color: #64748b;
  text-align: center;
}

.status,
.status-pill,
.chip,
.tag,
.quality-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 900;
}

.status.success,
.status-SUCCESS,
.status-DONE,
.status-COMPLETED,
.status-LINKED {
  border-color: #bbf7d0;
  background: var(--success-bg);
  color: var(--success-text);
}

.status.warning,
.status-REVIEW,
.status-PENDING,
.status-RUNNING,
.status-REQUESTING,
.status-PENDING_CONFIRM {
  border-color: #fed7aa;
  background: var(--warning-bg);
  color: var(--warning-text);
}

.status.danger,
.status-FAILED,
.status-BLOCK,
.status-BLOCKED,
.status-ERROR,
.status-TIMEOUT {
  border-color: #fecdd3;
  background: var(--danger-bg);
  color: var(--danger-text);
}

.notice,
.alert,
.global-job-bar,
.banner,
.hint-box {
  border-radius: 8px;
  border-width: 1px;
}

.notice.compact,
.alert.compact {
  padding: 8px 10px;
}

.global-job-bar {
  margin-bottom: 12px;
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
}

.erp-pagination,
.erp-client-pagination,
.task-pagination,
.pagination-row {
  min-height: 42px;
  margin-top: 10px;
  padding: 8px 0;
}

.erp-pager-total strong {
  color: #0f172a;
}

.erp-pager-size select {
  min-width: 108px;
}

.erp-pager-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.detail-drawer {
  border-left: 1px solid #d8e2ef;
  background: #ffffff;
  box-shadow: -18px 0 42px rgba(15, 23, 42, 0.18);
}

.detail-drawer-header {
  border-bottom: 1px solid #e8eef6;
  background: #ffffff;
}

.detail-drawer-header h2 {
  color: #0f172a;
  font-size: 18px;
  font-weight: 950;
}

.drawer-tabs {
  gap: 0;
  background: #fff;
}

.drawer-tab {
  border-radius: 0;
  color: #64748b;
}

.drawer-tab:hover {
  background: #f8fafc;
  color: #1d4ed8;
}

.drawer-tab.active {
  color: #2563eb;
  background: #fff;
}

.drawer-summary-list div {
  align-items: flex-start;
}

.drawer-summary-list strong,
.mono {
  overflow-wrap: anywhere;
}

.modal-backdrop {
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(2px);
}

.modal-panel,
.modal-card,
.modal-content,
.dialog-card {
  border: 1px solid #d8e2ef;
  border-radius: 10px;
  background: #fff;
}

.modal-close-btn,
.drawer-close,
.close-btn,
button[aria-label="关闭"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.modal-close-btn:hover,
.drawer-close:hover,
.close-btn:hover,
button[aria-label="关闭"]:hover {
  border-color: #adc5ff;
  background: #eaf2ff;
  color: #1d4ed8;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 240ms ease;
}

.ai-generation-layout {
  align-items: start;
}

.ai-generation-config {
  top: 68px;
}

.ai-generation-form {
  gap: 10px;
}

.ai-generation-progress {
  border-color: #dbeafe;
  background: #f8fbff;
}

.ai-generation-phase-grid {
  gap: 6px;
}

.ai-generation-phase-grid span {
  min-height: 30px;
  border-radius: 7px;
  background: #fff;
}

.ai-generation-evidence-grid div,
.ai-generation-coverage div {
  border-color: #dbe3ef;
  background: #fff;
}

.ai-generation-log-list {
  max-height: min(560px, 62vh);
}

.ai-generation-log-line {
  grid-template-columns: 150px 138px minmax(0, 1fr);
  border-radius: 7px;
}

.ai-generation-suggestion-table td:nth-child(4) {
  max-width: 360px;
}

.ai-generation-result {
  border-radius: 8px;
}

.run-step-card,
.compact-step-card {
  position: relative;
  overflow: hidden;
}

.run-step-card strong,
.compact-step-card strong {
  color: #0f172a;
}

.inline-json,
pre {
  border-radius: 8px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #eef2f7;
}

::-webkit-scrollbar-thumb {
  border: 2px solid #eef2f7;
  border-radius: 999px;
  background: #c4cfdd;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

@media (max-width: 1280px) {
  .main {
    padding: 14px;
  }

  .panel-title-row,
  .task-context-main,
  .page-head,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* v0.8.4: final shell collapse guard.
   Earlier UI iterations left both ::before and ::after short labels active,
   which made the collapsed sidebar show duplicated characters. Keep one
   readable short label and keep the toggle visible so users can reopen it. */
body.sidebar-collapsed {
  --sidebar-width: 72px;
  --sidebar-collapsed-width: 72px;
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width) !important;
  padding: 14px 8px !important;
  overflow-x: hidden;
}

body.sidebar-collapsed .main {
  margin-left: var(--sidebar-collapsed-width) !important;
}

body.sidebar-collapsed .brand-row {
  align-items: center !important;
  flex-direction: column !important;
  gap: 8px !important;
}

body.sidebar-collapsed .brand {
  justify-content: center !important;
  width: 100% !important;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-group-label {
  display: none !important;
}

body.sidebar-collapsed .sidebar-toggle {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  min-width: 36px !important;
  height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 18px !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

body.sidebar-collapsed .nav a,
body.sidebar-collapsed .nav-disabled-link {
  position: relative !important;
  display: flex !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 38px !important;
  padding: 8px 0 !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 1 !important;
}

body.sidebar-collapsed .nav a::before,
body.sidebar-collapsed .nav-disabled-link::before {
  content: none !important;
  display: none !important;
}

body.sidebar-collapsed .nav a::after,
body.sidebar-collapsed .nav-disabled-link::after,
body.sidebar-collapsed .nav a.nav-advanced-link::after {
  content: attr(data-short) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #1f2937 !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1.05 !important;
  letter-spacing: 0 !important;
  writing-mode: horizontal-tb !important;
}

body.sidebar-collapsed .nav a.active::after,
body.sidebar-collapsed .nav-disabled-link:focus::after,
body.sidebar-collapsed .nav-disabled-link:hover::after {
  color: #1d4ed8 !important;
}

/* v0.8.5: admin user management page, ERP-style dense list */
.admin-page {
  display: grid;
  gap: 12px;
}

.admin-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid #2563eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.admin-page-head h2 {
  margin: 6px 0 4px;
  color: #0f172a;
  font-size: 24px;
  line-height: 1.2;
}

.admin-page-head p {
  margin: 0;
  color: #64748b;
  font-size: 13px;
}

.admin-metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.admin-metric {
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid #c7d2fe;
  border-radius: 4px;
  background: linear-gradient(90deg, #6679c8, #7c8bd0);
  color: #fff;
}

.admin-metric.primary {
  background: linear-gradient(90deg, #2563eb, #3b82f6);
}

.admin-metric.warning {
  background: linear-gradient(90deg, #d97706, #f59e0b);
}

.admin-metric span {
  display: block;
  opacity: 0.92;
  font-size: 13px;
  font-weight: 800;
}

.admin-metric strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
}

.admin-register-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
}

.admin-register-copy h3 {
  margin: 0 0 4px;
  color: #0f172a;
  font-size: 16px;
}

.admin-register-copy p {
  margin: 0;
  color: #64748b;
  font-size: 13px;
}

.admin-register-form,
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-user-panel {
  padding: 16px;
}

.admin-user-filter {
  grid-template-columns: 180px 180px minmax(260px, 1fr) auto auto;
  margin-top: 12px;
  margin-bottom: 12px;
}

.admin-user-table-wrap {
  border-radius: 4px;
}

.admin-user-table {
  min-width: 1280px;
}

.admin-user-table th,
.admin-user-table td {
  white-space: nowrap;
  vertical-align: middle;
}

.admin-user-table th:nth-child(2),
.admin-user-table td:nth-child(2) {
  min-width: 180px;
}

.admin-user-table th:nth-child(6),
.admin-user-table td:nth-child(6) {
  min-width: 180px;
}

.admin-user-actions {
  min-width: 210px;
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.admin-user-table th:last-child,
.admin-user-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fff;
  box-shadow: -8px 0 16px rgba(15, 23, 42, 0.06);
}

.admin-user-table th:last-child {
  background: #f3f6fb;
  z-index: 3;
}

.admin-row-editor,
.admin-row-form {
  display: none !important;
}

.status-pill.primary {
  background: #eff6ff;
  color: #1d4ed8;
}

.status-pill.danger {
  background: #fef2f2;
  color: #b91c1c;
}

.btn.success {
  border-color: #bbf7d0;
  background: #10b981;
  color: #fff;
}

.btn.success:disabled {
  border-color: #e2e8f0;
  background: #f1f5f9;
  color: #94a3b8;
}

.admin-log-panel .table-wrap {
  max-height: 360px;
}

.admin-log-panel table {
  min-width: 1120px;
  table-layout: fixed;
}

.admin-log-panel th:nth-child(1),
.admin-log-panel td:nth-child(1) {
  width: 150px;
}

.admin-log-panel th:nth-child(2),
.admin-log-panel td:nth-child(2) {
  width: 150px;
}

.admin-log-panel th:nth-child(3),
.admin-log-panel td:nth-child(3) {
  width: 190px;
}

.admin-log-panel th:nth-child(4),
.admin-log-panel td:nth-child(4) {
  width: 120px;
}

.admin-log-panel th:nth-child(5),
.admin-log-panel td:nth-child(5) {
  width: 86px;
}

.admin-log-panel th:nth-child(7),
.admin-log-panel td:nth-child(7) {
  width: 132px;
}

.admin-log-main,
.admin-log-description,
.admin-log-ip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-log-description {
  max-width: 100%;
}

.admin-log-ip {
  color: #64748b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .admin-metric-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .admin-page-head,
  .admin-register-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-metric-strip,
  .admin-user-filter {
    grid-template-columns: 1fr;
  }
}

body.sidebar-collapsed .nav-disabled-link[disabled],
body.sidebar-collapsed .nav-disabled-link[aria-disabled="true"] {
  opacity: 0.55;
}

.inline-form.compact {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-form.compact input,
.inline-form.compact select {
  min-height: 32px;
  max-width: 180px;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  font-weight: 800;
}

.switch-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

/* v0.9.0 RuoYi-style console shell.
   This is the final visual layer for the beta admin/workspace UI. Keep it
   scoped near the end so older page-specific CSS cannot pull pages back into
   the previous card-heavy style. */
:root {
  --sidebar-width: 220px;
  --sidebar-collapsed-width: 64px;
  --console-bg: #f2f5fa;
  --console-panel: #ffffff;
  --console-panel-soft: #f7f9fc;
  --console-line: #dbe3ef;
  --console-line-soft: #edf1f7;
  --console-text: #1f2937;
  --console-strong: #0f172a;
  --console-muted: #64748b;
  --console-primary: #2f6fed;
  --console-primary-hover: #1d56d8;
  --console-primary-soft: #eaf2ff;
  --console-success: #10a66a;
  --console-warning: #d97706;
  --console-danger: #dc2626;
  --console-info: #0ea5e9;
  --console-radius: 6px;
  --console-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --console-shadow-lg: 0 18px 50px rgba(15, 23, 42, 0.18);
  --font-sans: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  background: var(--console-bg);
  color: var(--console-text);
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0;
}

body {
  margin: 0;
  overflow-x: hidden;
}

a {
  color: var(--console-primary);
  text-decoration: none;
}

a:hover {
  color: var(--console-primary-hover);
}

.app-shell.ruoyi-shell {
  min-height: 100vh;
  background: var(--console-bg);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: var(--sidebar-width) !important;
  padding: 14px 12px 18px !important;
  overflow-y: auto;
  border-right: 1px solid var(--console-line);
  background: #fff !important;
  box-shadow: 1px 0 3px rgba(15, 23, 42, 0.04);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 !important;
  color: var(--console-strong);
  font-size: 16px !important;
  font-weight: 800;
  line-height: 1.2;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
}

.brand-text {
  color: var(--console-strong);
  white-space: nowrap;
}

.sidebar-toggle,
.topbar-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 1px solid var(--console-line);
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sidebar-toggle:hover,
.topbar-menu-button:hover {
  border-color: #bfd2f6;
  background: var(--console-primary-soft);
  color: var(--console-primary);
}

.nav {
  display: grid;
  gap: 2px !important;
}

.nav-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 8px 8px !important;
  color: #8a96a8 !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

.nav-group-label span {
  color: #a7b0bf;
  font-size: 12px;
  font-weight: 700;
}

.nav a,
.nav-disabled-link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 38px;
  width: 100%;
  padding: 0 12px 0 16px !important;
  border: 0;
  border-radius: 6px !important;
  background: transparent;
  color: #344054 !important;
  font-size: 14px !important;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.nav a::before,
.nav-disabled-link::before {
  content: "";
  width: 4px;
  height: 4px;
  margin-right: 10px;
  border-radius: 50%;
  background: #c0cada;
}

.nav a:hover,
.nav-disabled-link:hover {
  background: #eef5ff !important;
  color: var(--console-primary) !important;
}

.nav a.active {
  background: linear-gradient(90deg, #e9f1ff, #f7fbff) !important;
  color: var(--console-primary) !important;
  box-shadow: inset 3px 0 0 var(--console-primary);
}

.nav a.active::before {
  background: var(--console-primary);
}

.nav-disabled-link {
  color: #98a2b3 !important;
  cursor: help;
}

.nav-disabled-link::before {
  background: #d6deea;
}

.main {
  min-height: 100vh;
  margin-left: 220px !important;
  width: calc(100vw - 220px);
  max-width: calc(100vw - 220px);
  min-width: 0;
  overflow-x: hidden;
  padding: 0 !important;
  background: var(--console-bg);
}

.topbar.ruoyi-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px !important;
  padding: 0 24px !important;
  border-bottom: 1px solid var(--console-line) !important;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(10px);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.topbar-left,
.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.topbar-title-stack {
  display: grid;
  gap: 1px;
}

.topbar-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--console-muted);
  font-size: 12px;
  line-height: 1;
}

.topbar-breadcrumb a {
  color: var(--console-muted);
}

.topbar h1 {
  margin: 0 !important;
  color: var(--console-strong);
  font-size: 18px !important;
  font-weight: 800 !important;
  line-height: 1.2;
}

.topbar-right {
  color: var(--console-muted);
  font-size: 13px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--console-line);
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-weight: 800;
}

.topbar-logout {
  margin: 0;
}

.ruoyi-tags-view {
  position: sticky;
  top: 58px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 24px;
  border-bottom: 1px solid var(--console-line);
  background: #fff;
  overflow-x: auto;
}

.ruoyi-tags-view a {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border: 1px solid #dfe7f2;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ruoyi-tags-view a.active,
.ruoyi-tags-view a:hover {
  border-color: #9fc0ff;
  background: var(--console-primary-soft);
  color: var(--console-primary);
}

.content {
  max-width: none;
  min-width: 0;
  overflow-x: hidden;
  padding: 16px 24px 36px !important;
}

.ruoyi-task-ribbon {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(120px, 0.8fr));
  gap: 1px;
  margin: 0 0 12px;
  overflow: hidden;
  border: 1px solid var(--console-line);
  border-radius: var(--console-radius);
  background: var(--console-line);
  box-shadow: var(--console-shadow);
}

.ruoyi-task-ribbon > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  background: #fff;
}

.ruoyi-task-ribbon span {
  color: var(--console-muted);
  font-size: 12px;
  font-weight: 700;
}

.ruoyi-task-ribbon strong {
  min-width: 0;
  color: var(--console-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel,
.task-context-bar,
.settings-hero,
.workbench-top,
.task-list-hero,
.admin-page-head,
.login-card,
.auth-card {
  border: 1px solid var(--console-line) !important;
  border-radius: var(--console-radius) !important;
  background: var(--console-panel) !important;
  box-shadow: var(--console-shadow) !important;
}

.panel,
.task-context-bar,
.settings-hero,
.workbench-top,
.task-list-hero {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 16px 18px !important;
  margin-bottom: 12px !important;
}

.task-context-bar {
  border-left: 4px solid var(--console-primary) !important;
}

.breadcrumb {
  margin-bottom: 6px !important;
  color: #6b778c !important;
  font-size: 12px !important;
  font-weight: 700;
}

.task-context-main h2,
.panel h2,
.settings-hero h2,
.workbench-top h2,
.task-list-hero h2,
.admin-page-head h2 {
  margin: 0 0 6px !important;
  color: var(--console-strong) !important;
  font-size: 20px !important;
  font-weight: 850 !important;
  line-height: 1.25;
}

.panel h3,
.drawer-section-title {
  color: var(--console-strong);
  font-size: 15px !important;
  font-weight: 850;
}

.muted,
.cell-muted,
small {
  color: var(--console-muted) !important;
  font-size: 12px;
}

.panel-title-row,
.task-context-main,
.section-head,
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.actions,
.ai-command-actions,
.task-row-actions,
.project-actions,
.admin-toolbar {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.btn,
button.btn,
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px !important;
  padding: 0 12px !important;
  border: 1px solid #d6dfeb;
  border-radius: 4px !important;
  background: #f8fafc;
  color: #27364a;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.btn:hover,
button.btn:hover,
a.btn:hover {
  border-color: #afc6ec;
  background: #eff6ff;
  color: var(--console-primary);
}

.btn.primary,
button.btn.primary,
a.btn.primary {
  border-color: var(--console-primary);
  background: var(--console-primary);
  color: #fff;
  box-shadow: 0 3px 8px rgba(47, 111, 237, 0.22);
}

.btn.primary:hover,
button.btn.primary:hover,
a.btn.primary:hover {
  border-color: var(--console-primary-hover);
  background: var(--console-primary-hover);
  color: #fff;
}

.btn.danger,
button.btn.danger,
a.btn.danger {
  border-color: #ef4444;
  background: #ef4444;
  color: #fff;
}

.btn.success,
button.btn.success,
a.btn.success {
  border-color: var(--console-success);
  background: var(--console-success);
  color: #fff;
}

.btn.warning,
button.btn.warning,
a.btn.warning {
  border-color: #f59e0b;
  background: #f59e0b;
  color: #fff;
}

.btn.small,
button.btn.small,
a.btn.small {
  min-height: 28px !important;
  padding: 0 9px !important;
  font-size: 12px !important;
}

.btn.ghost,
button.btn.ghost,
a.btn.ghost {
  background: #fff;
}

.btn:disabled,
button:disabled,
a.btn[aria-disabled="true"] {
  border-color: #e4e9f1 !important;
  background: #f1f5f9 !important;
  color: #a5b1c2 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

.link-button {
  color: var(--console-primary) !important;
  font-weight: 850 !important;
}

input,
select,
textarea,
.form-control {
  min-height: 34px;
  border: 1px solid #cfd8e6 !important;
  border-radius: 4px !important;
  background: #fff !important;
  color: var(--console-text) !important;
  font-family: var(--font-sans);
  font-size: 13px !important;
  outline: none;
}

input:hover,
select:hover,
textarea:hover,
.form-control:hover {
  border-color: #9db8e8 !important;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
  border-color: var(--console-primary) !important;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12) !important;
}

select,
option {
  color: var(--console-text) !important;
  background: #fff !important;
}

option:checked {
  background: var(--console-primary-soft) !important;
  color: var(--console-primary) !important;
}

input[type="checkbox"],
input[type="radio"] {
  min-height: 0;
  accent-color: var(--console-primary);
}

label {
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.erp-filter-bar,
.task-filter-bar,
.settings-provider-filter,
.dashboard-filter-bar,
.admin-user-filter,
.visual-case-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 12px 0 !important;
  padding: 12px !important;
  border: 1px solid var(--console-line-soft) !important;
  border-radius: var(--console-radius) !important;
  background: #f8fafc !important;
}

.erp-filter-bar label,
.task-filter-bar label,
.settings-provider-filter label,
.dashboard-filter-bar label,
.admin-user-filter label,
.visual-case-filters label {
  display: grid;
  gap: 5px;
  color: #536176;
  font-size: 12px;
  font-weight: 800;
}

.table-wrap,
.admin-user-table-wrap,
.task-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--console-line) !important;
  border-radius: 4px !important;
  background: #fff;
}

table,
.erp-table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  color: var(--console-text);
}

.erp-table th,
table th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 40px;
  padding: 8px 10px !important;
  border-bottom: 1px solid var(--console-line) !important;
  background: #f3f6fb !important;
  color: #3f4f65 !important;
  font-size: 12px !important;
  font-weight: 850 !important;
  text-align: left;
  white-space: nowrap;
}

.erp-table td,
table td {
  min-height: 42px;
  padding: 9px 10px !important;
  border-bottom: 1px solid #edf2f7 !important;
  color: var(--console-text);
  font-size: 13px !important;
  vertical-align: middle !important;
}

.erp-table tbody tr,
table tbody tr {
  background: #fff;
}

.erp-table tbody tr:nth-child(even),
table tbody tr:nth-child(even) {
  background: #fbfcfe;
}

.erp-table tbody tr:hover,
table tbody tr:hover {
  background: #eef6ff !important;
}

.erp-table .selected,
.task-list-row.selected,
.erp-case-row.selected {
  background: #eaf2ff !important;
  box-shadow: inset 3px 0 0 var(--console-primary);
}

.truncate-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono {
  font-family: "Cascadia Mono", "Consolas", monospace;
  letter-spacing: 0;
}

.status,
.status-pill,
.risk-pill,
.badge,
.label,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.status-REPORT_READY,
.status-DONE,
.status-COMPLETED,
.status-SUCCESS,
.status-LINKED,
.status-PASS,
.status-pill.success,
.risk-pill.success {
  background: #e9fbf2 !important;
  color: #047857 !important;
}

.status-RUNNING,
.status-AI_VISUAL_RUNNING,
.status-READY,
.status-CREATED,
.status-pill.primary,
.risk-pill.info {
  background: var(--console-primary-soft) !important;
  color: var(--console-primary) !important;
}

.status-BLOCKED,
.status-ERROR,
.status-FAILED,
.status-FAIL,
.status-pill.danger,
.risk-pill.danger {
  background: #fef2f2 !important;
  color: #b91c1c !important;
}

.status-REVIEW,
.status-PENDING_CONFIRM,
.status-COMPLETED_WITH_REVIEW,
.status-COMPLETED_WITH_BLOCKS,
.status-pill.warn,
.risk-pill.warning {
  background: #fff7ed !important;
  color: #c2410c !important;
}

.notice {
  border: 1px solid #d7e3f4 !important;
  border-radius: 4px !important;
  background: #f8fbff !important;
  color: #334155 !important;
}

.notice.info {
  border-color: #bfdbfe !important;
  background: #eff6ff !important;
  color: #1e3a8a !important;
}

.notice.warning {
  border-color: #fed7aa !important;
  background: #fff7ed !important;
  color: #9a3412 !important;
}

.notice.error,
.notice.danger {
  border-color: #fecaca !important;
  background: #fef2f2 !important;
  color: #991b1b !important;
}

.notice.success {
  border-color: #bbf7d0 !important;
  background: #ecfdf5 !important;
  color: #065f46 !important;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 120px;
  color: var(--console-muted);
  text-align: center;
}

.empty-state strong {
  color: var(--console-strong);
  font-size: 15px;
}

.erp-client-pagination,
.erp-pagination,
.task-pagination,
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 46px;
  padding: 10px 0 0;
  color: var(--console-muted);
  font-size: 13px;
}

.erp-pager-controls,
.erp-pager-size,
.erp-pager-jump {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
}

.erp-pager-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 4px;
  background: var(--console-primary);
  color: #fff;
  font-weight: 850;
}

.erp-pager-jump input,
.task-pagination input {
  width: 64px;
  text-align: center;
}

.workbench-alert-strip,
.erp-summary-strip,
.task-list-summary,
.admin-metric-strip,
.ai-summary-grid,
.ai-run-dashboard,
.drawer-metric-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.workbench-alert-chip,
.erp-summary-strip > div,
.task-list-summary > button,
.admin-metric,
.ai-summary-card,
.ai-run-status-tile,
.ai-run-progress-tile,
.ai-run-dashboard > div,
.drawer-metric-grid > div {
  min-height: 64px;
  padding: 11px 12px;
  border: 1px solid var(--console-line);
  border-radius: 4px;
  background: #fff;
  color: var(--console-text);
  box-shadow: var(--console-shadow);
}

.workbench-alert-chip:hover,
.task-list-summary > button:hover {
  border-color: #a9c5f5;
  background: #f8fbff;
}

.workbench-alert-chip strong,
.erp-summary-strip strong,
.task-list-summary strong,
.admin-metric strong,
.ai-run-dashboard strong {
  color: var(--console-primary);
  font-size: 22px;
  line-height: 1.1;
}

.admin-metric {
  border: 0;
  background: linear-gradient(90deg, #536dbe, #6f83cf) !important;
  color: #fff;
}

.admin-metric strong,
.admin-metric span {
  color: #fff !important;
}

.detail-drawer {
  position: fixed !important;
  top: 0;
  right: 0;
  z-index: 110;
  width: min(720px, calc(100vw - 24px));
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-left: 1px solid var(--console-line);
  background: #fff;
  box-shadow: var(--console-shadow-lg);
}

.detail-drawer[hidden] {
  display: none !important;
}

.detail-drawer-header,
.drawer-footer {
  padding: 16px 18px;
  border-bottom: 1px solid var(--console-line);
  background: #fff;
}

.drawer-footer {
  border-top: 1px solid var(--console-line);
  border-bottom: 0;
}

.drawer-body {
  overflow: auto;
  padding: 16px 18px;
}

.modal-backdrop {
  z-index: 120;
  background: rgba(15, 23, 42, 0.48) !important;
  backdrop-filter: blur(2px);
}

.modal-card,
.modal-panel,
.evidence-modal,
.design-modal-card {
  border: 1px solid var(--console-line) !important;
  border-radius: 10px !important;
  background: #fff !important;
  box-shadow: var(--console-shadow-lg) !important;
}

.modal-close-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  padding: 0 !important;
  border: 1px solid var(--console-line) !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
  color: #334155 !important;
  font-size: 20px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

.modal-close-btn:hover {
  border-color: #fecaca !important;
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

.global-toast {
  position: fixed;
  right: 24px;
  top: 80px;
  z-index: 200;
  max-width: 420px;
  padding: 10px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1e3a8a;
  box-shadow: var(--console-shadow-lg);
  font-weight: 800;
}

.global-toast.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.global-toast.warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.global-toast.success {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #065f46;
}

.global-job-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 38%) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--console-primary);
  border-radius: 6px;
  background: #eff6ff;
}

.global-job-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.global-job-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--console-primary);
  box-shadow: 0 0 0 6px rgba(47, 111, 237, 0.12);
}

.global-job-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.global-job-copy strong {
  color: var(--console-strong);
}

.global-job-copy span,
.global-job-path {
  overflow: hidden;
  color: #475569;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-job-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}

.global-job-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f6fed, #0ea5e9);
}

.global-job-side {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.ai-command-panel-v2,
.ai-current-case-panel,
.ai-run-dashboard,
.ai-run-summary,
.current-step-panel,
.run-step-panel {
  margin-bottom: 12px !important;
}

.ai-command-head,
.ai-command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  min-width: 0;
}

.ai-command-bar {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--console-line-soft);
  border-radius: 4px;
  background: #f8fafc;
}

.ai-command-bar label {
  display: grid;
  gap: 5px;
  min-width: min(220px, 100%);
  flex: 1 1 220px;
}

.ai-command-actions {
  flex: 1 1 420px;
  justify-content: flex-end;
  max-width: 100%;
  min-width: 0;
}

.ai-command-panel-v2 .ai-command-actions {
  flex-wrap: wrap !important;
}

.ai-command-head > div:first-child {
  flex: 1 1 360px;
  min-width: min(360px, 100%);
}

.ai-role-form,
.settings-ai-summary {
  min-width: 0;
}

.settings-ai-summary {
  grid-template-columns: minmax(220px, 280px) minmax(180px, 240px);
  align-items: start;
}

.ai-role-form {
  grid-column: 1 / -1;
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--console-line-soft);
  border-radius: 4px;
  background: #f8fafc;
}

.ai-role-select,
.ai-role-select select,
.ai-summary-card,
.settings-provider-panel,
.settings-provider-table,
.task-list-page,
.workbench-task-panel,
.task-list-panel {
  min-width: 0;
}

.ai-current-case-focus,
.current-step-grid,
.ai-step-workspace,
.run-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.4fr);
  gap: 14px;
}

.case-focus-main,
.case-focus-proof,
.proof-block,
.step-evidence-card,
.run-step-card,
.compact-step-card {
  border: 1px solid var(--console-line);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--console-shadow);
}

.case-focus-main,
.case-focus-proof {
  padding: 14px;
}

.case-focus-proof {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border: 0;
  box-shadow: none;
}

.proof-block {
  padding: 12px;
}

.proof-block span {
  display: block;
  margin-bottom: 6px;
  color: var(--console-muted);
  font-size: 12px;
  font-weight: 800;
}

.proof-block strong {
  color: var(--console-strong);
  font-size: 14px;
}

.run-step-card,
.compact-step-card {
  padding: 12px !important;
  margin-bottom: 10px !important;
}

.run-step-card:hover,
.compact-step-card:hover {
  border-color: #a9c5f5;
  background: #f8fbff;
}

.inline-json,
pre,
code {
  font-family: "Cascadia Mono", "Consolas", monospace;
}

pre,
.inline-json {
  max-height: 320px;
  overflow: auto;
  border: 1px solid #d4dce8 !important;
  border-radius: 6px !important;
  background: #101828 !important;
  color: #dbeafe !important;
}

img {
  max-width: 100%;
}

.image-preview,
.screenshot-preview,
.current-screenshot,
.step-screenshot {
  border: 1px solid var(--console-line);
  border-radius: 6px;
  background: #f8fafc;
}

body.sidebar-collapsed {
  --sidebar-width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width) !important;
  padding: 12px 8px !important;
}

body.sidebar-collapsed .main {
  margin-left: 72px !important;
  width: calc(100vw - 72px) !important;
  max-width: calc(100vw - 72px) !important;
}

html body.sidebar-collapsed > .app-shell.ruoyi-shell > .main {
  margin-left: 72px !important;
  width: calc(100vw - 72px) !important;
  max-width: calc(100vw - 72px) !important;
}

html body:not(.sidebar-collapsed) > .app-shell.ruoyi-shell > .main {
  margin-left: 220px !important;
  width: calc(100vw - 220px) !important;
  max-width: calc(100vw - 220px) !important;
}

body.sidebar-collapsed .brand-row {
  justify-content: center !important;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-group-label {
  display: none !important;
}

body.sidebar-collapsed .brand {
  justify-content: center !important;
}

body.sidebar-collapsed .brand-mark {
  width: 36px;
  height: 36px;
}

body.sidebar-collapsed .sidebar-toggle {
  display: none !important;
}

body.sidebar-collapsed .nav a,
body.sidebar-collapsed .nav-disabled-link {
  justify-content: center !important;
  height: 38px;
  padding: 0 !important;
  overflow: hidden !important;
  color: transparent !important;
  font-size: 0 !important;
}

body.sidebar-collapsed .nav a::before,
body.sidebar-collapsed .nav-disabled-link::before {
  content: none !important;
}

body.sidebar-collapsed .nav a::after,
body.sidebar-collapsed .nav-disabled-link::after,
body.sidebar-collapsed .nav a.nav-advanced-link::after {
  content: attr(data-short) !important;
  display: inline-flex !important;
  color: #334155 !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

body.sidebar-collapsed .nav a.active::after {
  color: var(--console-primary) !important;
}

@media (max-width: 1280px) {
  .ruoyi-task-ribbon,
  .ai-current-case-focus,
  .current-step-grid,
  .ai-step-workspace,
  .run-workspace,
  .global-job-bar {
    grid-template-columns: 1fr;
  }

  .topbar.ruoyi-topbar,
  .ruoyi-tags-view,
  .content {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

@media (max-width: 860px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  body:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0);
    width: 220px !important;
  }

  .main,
  body.sidebar-collapsed .main {
    margin-left: 0 !important;
    width: 100vw;
    max-width: 100vw;
  }

  .topbar-title-stack h1 {
    font-size: 16px !important;
  }

  .topbar-right {
    gap: 6px;
  }

  .panel-title-row,
  .task-context-main,
  .ai-command-head,
  .ai-command-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .case-focus-proof {
    grid-template-columns: 1fr;
  }
}

/* v0.9.1 RuoYi page model refinement.
   The shell now stays light; this layer makes page interiors denser and table-first. */
.content {
  padding-top: 12px !important;
}

.panel,
.task-context-bar,
.workbench-top,
.task-list-hero,
.settings-hero,
.admin-hero,
.ai-command-panel-v2,
.ai-run-live-strip,
.ai-step-workspace,
.run-summary-panel,
.ai-suggestion-preview,
.admin-page-panel,
.settings-provider-panel,
.erp-page-panel {
  border-radius: 4px !important;
  box-shadow: none !important;
}

.panel {
  margin-bottom: 12px !important;
  padding: 14px 16px !important;
}

.panel-title-row {
  min-height: 36px;
  margin-bottom: 12px !important;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf1f7;
}

.panel-title-row h2,
.panel h2,
.ai-command-head h2,
.run-summary-panel h2,
.ai-step-workspace h2 {
  margin: 0;
  color: #0f172a !important;
  font-size: 16px !important;
  font-weight: 850 !important;
  line-height: 1.35;
}

.panel-title-row p,
.panel > p.muted,
.ai-command-head p,
.task-context-main p,
.workbench-top p,
.settings-hero p {
  margin-top: 4px !important;
  color: #64748b !important;
  font-size: 12px !important;
  line-height: 1.5;
}

.task-context-bar,
.workbench-top,
.task-list-hero,
.settings-hero,
.admin-hero {
  position: relative;
  padding: 12px 16px !important;
  border-left: 3px solid var(--console-primary) !important;
  background: #fff !important;
}

.task-context-main,
.workbench-top .header-row,
.settings-hero .header-row {
  gap: 12px !important;
}

.task-context-title,
.workbench-top h2,
.task-list-hero h2,
.settings-hero h2,
.admin-hero h2 {
  margin: 0 !important;
  color: #0f172a !important;
  font-size: 18px !important;
  font-weight: 900 !important;
}

.context-stats,
.workbench-alert-strip,
.erp-summary-strip,
.task-list-summary,
.admin-metric-strip,
.ai-summary-grid,
.drawer-metric-grid {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px !important;
  margin: 8px 0 12px !important;
}

.context-stats > *,
.workbench-alert-chip,
.erp-summary-strip > div,
.task-list-summary > button,
.admin-metric,
.ai-summary-card,
.drawer-metric-grid > div {
  min-height: 36px !important;
  padding: 7px 10px !important;
  border: 1px solid #dfe6f1 !important;
  border-radius: 4px !important;
  background: #fff !important;
  box-shadow: none !important;
}

.workbench-alert-chip strong,
.erp-summary-strip strong,
.task-list-summary strong,
.admin-metric strong,
.ai-summary-card strong,
.drawer-metric-grid strong {
  color: var(--console-primary) !important;
  font-size: 16px !important;
  line-height: 1.1 !important;
}

.admin-metric,
.admin-metric strong,
.admin-metric span {
  color: var(--console-text) !important;
}

.admin-metric {
  background: #fff !important;
}

.erp-filter-bar,
.task-filter-bar,
.admin-user-filter,
.settings-provider-filter,
.report-filter-bar,
.run-filter-bar,
.codex-filter-bar {
  align-items: end !important;
  gap: 10px !important;
  margin: 0 0 10px !important;
  padding: 12px !important;
  border: 1px solid #e5ebf5 !important;
  border-radius: 4px !important;
  background: #f7f9fc !important;
  box-shadow: none !important;
}

.erp-filter-bar label,
.task-filter-bar label,
.admin-user-filter label,
.settings-provider-filter label,
.report-filter-bar label,
.run-filter-bar label,
.codex-filter-bar label {
  color: #41506a !important;
  font-size: 12px !important;
  font-weight: 750 !important;
}

.erp-bulk-toolbar,
.visual-case-toolbar,
.task-selection-bar,
.admin-toolbar,
.settings-toolbar {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center !important;
  gap: 8px !important;
  min-height: 38px;
  margin: 0 0 10px !important;
  padding: 8px 10px !important;
  border: 1px solid #e5ebf5 !important;
  border-radius: 4px !important;
  background: #fff !important;
}

.table-wrap,
.erp-table-wrap,
.admin-table-wrap,
.settings-table-wrap {
  overflow: auto;
  border: 1px solid #dfe6f1 !important;
  border-radius: 4px !important;
  background: #fff !important;
  box-shadow: none !important;
}

table,
.erp-table,
.data-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.erp-table th,
.data-table th,
table th {
  height: 40px !important;
  padding: 9px 10px !important;
  border-bottom: 1px solid #dfe6f1 !important;
  background: #f2f5fa !important;
  color: #344054 !important;
  font-size: 12px !important;
  font-weight: 850 !important;
  white-space: nowrap;
}

.erp-table td,
.data-table td,
table td {
  min-height: 42px !important;
  padding: 9px 10px !important;
  border-bottom: 1px solid #edf1f7 !important;
  color: #344054;
  vertical-align: middle;
}

.erp-table tbody tr:hover,
.data-table tbody tr:hover,
table tbody tr:hover {
  background: #f7fbff !important;
}

.erp-table a,
.data-table a,
table a {
  color: var(--console-primary);
  font-weight: 800;
}

.btn,
button,
input[type="button"],
input[type="submit"] {
  min-height: 32px !important;
  border-radius: 4px !important;
  font-weight: 800 !important;
}

.btn.primary,
button.primary,
.btn.btn-primary {
  background: var(--console-primary) !important;
  border-color: var(--console-primary) !important;
  color: #fff !important;
}

.btn.secondary,
.btn.ghost,
button.secondary,
button.ghost {
  background: #f3f6fb !important;
  border-color: #dfe6f1 !important;
  color: #1f2937 !important;
}

.btn.danger,
button.danger {
  background: #e03131 !important;
  border-color: #e03131 !important;
  color: #fff !important;
}

input,
select,
textarea,
.form-control {
  min-height: 34px !important;
  background: #fff !important;
  color: #1f2937 !important;
  -webkit-text-fill-color: #1f2937;
}

select,
select:hover,
select:focus,
select:active,
select option,
select option:hover,
select option:checked,
select option:focus {
  background-color: #fff !important;
  color: #1f2937 !important;
  -webkit-text-fill-color: #1f2937 !important;
}

select:disabled,
input:disabled,
textarea:disabled {
  background: #f3f6fb !important;
  color: #94a3b8 !important;
  -webkit-text-fill-color: #94a3b8 !important;
}

.pagination,
.pager,
.erp-pager,
.task-pagination {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 8px !important;
  min-height: 42px;
  margin-top: 10px !important;
  padding: 6px 0 !important;
  color: #475569;
}

.legacy-case-config:not(.expanded),
.legacy-case-create:not(.expanded) {
  display: none !important;
}

.legacy-case-config.expanded,
.legacy-case-create.expanded {
  display: block !important;
  border-left: 3px solid var(--console-primary) !important;
}

.erp-page-panel {
  margin-top: 0 !important;
}

.erp-page-panel > .notice.info,
details.notice.info {
  display: none !important;
}

.ai-command-panel-v2 {
  padding: 14px 16px !important;
}

.ai-command-bar {
  gap: 8px !important;
  padding: 10px 0 0 !important;
  border-top: 1px solid #edf1f7;
}

.ai-run-dashboard {
  display: grid !important;
  grid-template-columns: minmax(260px, 0.75fr) minmax(420px, 1.5fr) minmax(260px, 0.85fr);
  gap: 10px !important;
  margin-bottom: 12px !important;
}

.ai-run-status-tile,
.ai-run-progress-tile,
.ai-run-result-tile,
.ai-run-dashboard > div {
  min-height: 76px !important;
  padding: 12px !important;
  border: 1px solid #dfe6f1 !important;
  border-radius: 4px !important;
  background: #fff !important;
  box-shadow: none !important;
}

.ai-run-status-tile strong,
.ai-run-progress-tile strong,
.ai-run-result-tile strong {
  color: #0f172a !important;
  font-size: 18px !important;
}

.ai-current-case-focus,
.current-step-grid,
.ai-step-workspace,
.run-workspace {
  display: grid !important;
  grid-template-columns: minmax(300px, 0.82fr) minmax(460px, 1.18fr);
  gap: 12px !important;
}

.case-focus-main,
.case-focus-proof,
.proof-block,
.step-evidence-card,
.run-step-card,
.compact-step-card {
  border-radius: 4px !important;
  box-shadow: none !important;
}

.ai-bottom-grid {
  display: grid !important;
  grid-template-columns: minmax(520px, 1.1fr) minmax(360px, 0.9fr);
  gap: 12px !important;
}

.ai-step-workspace .current-screenshot,
.screenshot-preview,
.case-focus-proof img,
.step-evidence-card img {
  border: 1px solid #dfe6f1 !important;
  border-radius: 4px !important;
  background: #f8fafc !important;
}

.modal,
.modal-card,
.modal-content,
.ai-run-detail-modal .modal-content {
  border-radius: 6px !important;
  box-shadow: 0 18px 54px rgba(15, 23, 42, 0.22) !important;
}

.modal-close,
.drawer-close,
.close-button {
  border-radius: 4px !important;
}

@media (max-width: 1280px) {
  .ai-run-dashboard,
  .ai-current-case-focus,
  .current-step-grid,
  .ai-step-workspace,
  .run-workspace,
  .ai-bottom-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 860px) {
  .panel,
  .task-context-bar,
  .workbench-top,
  .task-list-hero,
  .settings-hero,
  .admin-hero {
    padding: 12px !important;
  }

  .context-stats,
  .workbench-alert-strip,
  .erp-summary-strip,
  .task-list-summary,
  .admin-metric-strip,
  .ai-summary-grid,
  .drawer-metric-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
  }
}

/* v0.9.4 absolute-final page fixes. Keep this block last. */
.settings-ai-summary.ai-summary-grid {
  display: grid !important;
  grid-template-columns: minmax(170px, 220px) minmax(420px, 1fr) minmax(180px, 240px) !important;
  align-items: stretch !important;
  gap: 10px !important;
  width: 100%;
}

.settings-ai-summary .ai-summary-card {
  min-width: 0 !important;
  min-height: 64px !important;
}

.settings-ai-summary .ai-role-form {
  grid-column: auto !important;
  width: 100%;
  min-width: 0 !important;
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
  align-items: start !important;
  gap: 10px !important;
  overflow: hidden;
}

.settings-ai-summary .ai-role-select,
.settings-ai-summary .ai-role-select select {
  min-width: 0 !important;
  width: 100% !important;
}

.settings-ai-summary .ai-role-actions {
  grid-column: 1 / -1 !important;
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ai-command-panel-v2 .ai-command-head {
  display: grid !important;
  grid-template-columns: 1fr !important;
  align-items: start !important;
  gap: 10px !important;
}

.ai-command-panel-v2 .ai-command-head > div:first-child,
.ai-command-panel-v2 .ai-command-actions {
  min-width: 0 !important;
  width: 100%;
}

.ai-command-panel-v2 .ai-command-actions {
  justify-content: flex-start !important;
  flex: 0 1 auto !important;
}

.ai-command-panel-v2 .ai-command-actions .btn,
.ai-command-panel-v2 .more-menu > summary {
  min-width: auto !important;
  white-space: nowrap;
}

.ai-command-panel-v2 .ai-command-bar {
  display: grid !important;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(160px, auto) minmax(150px, auto) !important;
  align-items: end !important;
  gap: 10px !important;
}

.ai-command-panel-v2 .ai-command-bar label {
  min-width: 0 !important;
}

.ai-command-panel-v2 .ai-command-bar select,
.ai-command-panel-v2 .ai-command-bar input[type="number"] {
  width: 100% !important;
  min-width: 0 !important;
}

.ai-command-panel-v2 #run-message {
  margin: 0 !important;
}

@media (max-width: 1400px) {
  .settings-ai-summary.ai-summary-grid {
    grid-template-columns: 1fr !important;
  }

  .settings-ai-summary .ai-role-form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 1120px) {
  .ai-command-panel-v2 .ai-command-bar {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 760px) {
  .settings-ai-summary .ai-role-form,
  .ai-command-panel-v2 .ai-command-bar {
    grid-template-columns: 1fr !important;
  }
}

/* v0.9.5 admin action dialogs and hint de-noising. */
.title-with-tip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.title-with-tip h2,
.title-with-tip h3 {
  margin: 0 !important;
}

.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 18px !important;
  padding: 0 !important;
  border: 1px solid #bcd0f7 !important;
  border-radius: 50% !important;
  background: #f4f8ff !important;
  color: #2563eb !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  cursor: help;
  box-shadow: none !important;
}

.info-tip::after {
  content: none !important;
  display: none !important;
}

.info-tip:hover,
.info-tip:focus-visible,
[data-tooltip]:hover,
[data-tooltip]:focus-visible {
  border-color: #7aa7f8 !important;
  background: #eaf2ff !important;
  color: #1d4ed8 !important;
}

.global-help-tooltip {
  position: fixed;
  z-index: 10020;
  max-width: min(360px, calc(100vw - 28px));
  padding: 8px 10px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 4px;
  background: #111827;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.55;
  white-space: normal;
  word-break: break-word;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

.global-help-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.admin-page-head {
  align-items: center !important;
}

.admin-page-head p,
.admin-register-copy p,
.admin-toolbar > .muted {
  display: none !important;
}

.admin-toolbar {
  justify-content: flex-start;
}

.admin-user-actions {
  min-width: 150px !important;
  align-items: center !important;
}

.admin-action-backdrop {
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-action-backdrop[hidden] {
  display: none !important;
}

.admin-action-modal {
  width: min(520px, 94vw) !important;
  max-height: min(720px, 92vh);
  overflow: auto;
  padding: 0 !important;
  border-radius: 6px !important;
}

.modal-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #edf1f7;
}

.modal-title-row h3 {
  margin: 0;
  color: #0f172a;
  font-size: 17px;
  font-weight: 900;
}

.modal-title-row p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.admin-modal-form {
  display: grid;
  gap: 12px;
  padding: 16px 18px 18px;
}

.admin-modal-form[hidden] {
  display: none !important;
}

.admin-modal-form label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

.modal-warning {
  padding: 8px 10px;
  border: 1px solid #fde68a;
  border-radius: 4px;
  background: #fffbeb;
  color: #92400e !important;
  font-size: 12px;
}

.danger-confirm-box {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 4px;
  background: #fff1f2;
  color: #991b1b;
}

.danger-confirm-box strong {
  font-size: 13px;
}

.danger-confirm-box span {
  font-size: 12px;
  color: #b91c1c;
}

.danger-confirm-check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
  padding: 8px 10px;
  border: 1px solid #fee2e2;
  border-radius: 4px;
  background: #fff7f7;
  color: #7f1d1d !important;
}

.modal-form-error {
  padding: 8px 10px;
  border: 1px solid #fecaca;
  border-radius: 4px;
  background: #fef2f2;
  color: #b42318;
  font-size: 12px;
  font-weight: 700;
}

.modal-form-error[hidden] {
  display: none !important;
}

.admin-action-modal .modal-actions {
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid #edf1f7;
}

/* v0.9.6 controlled-beta hotfix: keep native selects readable on hover/focus. */
select,
select:hover,
select:focus,
select:active,
select option,
select option:hover,
select option:focus,
select option:active,
select option:checked,
select optgroup {
  color: #111827 !important;
  background-color: #ffffff !important;
  -webkit-text-fill-color: #111827 !important;
  text-shadow: none !important;
}

select option:hover,
select option:focus,
select option:active {
  color: #0f172a !important;
  background-color: #eaf2ff !important;
  -webkit-text-fill-color: #0f172a !important;
  box-shadow: 0 0 0 100vmax #eaf2ff inset !important;
}

select option:checked {
  color: #0f172a !important;
  background-color: #dbeafe !important;
  -webkit-text-fill-color: #0f172a !important;
  box-shadow: 0 0 0 100vmax #dbeafe inset !important;
}

select:disabled,
select:disabled option {
  color: #94a3b8 !important;
  background-color: #f8fafc !important;
  -webkit-text-fill-color: #94a3b8 !important;
}

/* v0.9.6 controlled-beta hotfix: filter bars must wrap instead of causing horizontal overflow. */
.erp-filter-bar,
.task-filter-bar,
.admin-user-filter,
.settings-provider-filter,
.report-filter-bar,
.run-filter-bar,
.codex-filter-bar,
.visual-case-filters,
.dashboard-filter-bar {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.erp-filter-bar > .btn,
.erp-filter-bar > button,
.task-filter-bar > .btn,
.task-filter-bar > button,
.admin-user-filter > .btn,
.admin-user-filter > button,
.settings-provider-filter > .btn,
.settings-provider-filter > button,
.report-filter-bar > .btn,
.report-filter-bar > button,
.run-filter-bar > .btn,
.run-filter-bar > button,
.codex-filter-bar > .btn,
.codex-filter-bar > button,
.visual-case-filters > .btn,
.visual-case-filters > button,
.dashboard-filter-bar > .btn,
.dashboard-filter-bar > button {
  width: 100%;
  min-width: 0;
}

/* v0.9.6 controlled-beta hotfix: avoid 100vw scrollbar overflow in the app shell. */
html body > .app-shell.ruoyi-shell > .main,
html body:not(.sidebar-collapsed) > .app-shell.ruoyi-shell > .main,
html body.sidebar-collapsed > .app-shell.ruoyi-shell > .main,
body.sidebar-collapsed .main {
  width: auto !important;
  max-width: none !important;
}

/* v0.9.6 controlled-beta hotfix: collapsed sidebar labels stay horizontal and clickable. */
body.sidebar-collapsed .nav a,
body.sidebar-collapsed .nav-disabled-link {
  width: 46px !important;
  min-width: 46px !important;
  max-width: 46px !important;
  margin: 0 auto !important;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
}

/* v0.9.7 shared in-app dialog: replace native confirm/prompt/alert flows. */
.app-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(3px);
}

.app-dialog-backdrop[hidden] {
  display: none !important;
}

.app-dialog-panel {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  width: min(520px, calc(100vw - 32px));
  padding: 22px 22px 18px;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.24);
}

.app-dialog-x {
  position: absolute;
  top: 12px;
  right: 12px;
}

.app-dialog-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-top: 2px;
  color: #1d4ed8;
  font-weight: 800;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 50%;
}

.app-dialog-backdrop.is-danger .app-dialog-icon {
  color: #dc2626;
  background: #fff1f2;
  border-color: #fecdd3;
}

.app-dialog-body h2 {
  margin: 0 32px 8px 0;
  font-size: 18px;
  line-height: 1.35;
}

.app-dialog-body p {
  margin: 0;
  color: #475569;
  line-height: 1.7;
  white-space: pre-wrap;
}

.app-dialog-input {
  width: 100%;
  margin-top: 14px;
}

.app-dialog-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 12px;
}

@media (min-width: 861px) {
  body.sidebar-collapsed .sidebar {
    transform: none !important;
    left: 0 !important;
  }
}

body.sidebar-collapsed .nav a::after,
body.sidebar-collapsed .nav-disabled-link::after,
body.sidebar-collapsed .nav a.nav-advanced-link::after {
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  justify-content: center !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  text-overflow: clip !important;
  letter-spacing: 0 !important;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
}

/* v0.10.0 ERP framework pass: final visual layer, no business behavior changes. */
:root {
  --sidebar-width: 200px !important;
  --sidebar-collapsed-width: 64px !important;
  --console-bg: #f3f6fb;
  --console-card: #ffffff;
  --console-line: #dce5f2;
  --console-soft-line: #edf2f8;
  --console-primary: #2563eb;
  --console-primary-dark: #1d4ed8;
  --console-primary-soft: #eaf2ff;
  --console-danger: #dc2626;
  --console-success: #059669;
  --console-warning: #d97706;
  --console-text: #102033;
  --console-muted: #66758a;
  --console-sidebar: #152238;
  --console-sidebar-muted: #aebbd0;
  --console-sidebar-active: #2563eb;
  --console-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

html,
body {
  color: var(--console-text) !important;
  background: var(--console-bg) !important;
  font-size: 14px;
}

.app-shell.ruoyi-shell {
  min-height: 100vh;
  background: var(--console-bg) !important;
}

.sidebar {
  position: fixed !important;
  inset: 0 auto 0 0 !important;
  z-index: 80 !important;
  width: var(--sidebar-width) !important;
  padding: 12px 10px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  color: #e8eef8 !important;
  background: var(--console-sidebar) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
}

.brand-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  min-height: 48px !important;
  padding: 0 4px 12px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.brand {
  display: flex !important;
  align-items: center !important;
  min-width: 0 !important;
  gap: 10px !important;
}

.brand-mark {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 34px !important;
  height: 34px !important;
  flex: 0 0 34px !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  background: linear-gradient(135deg, #2563eb, #38bdf8) !important;
  border-radius: 9px !important;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28) !important;
}

.brand-text {
  color: #ffffff !important;
  font-size: 15px !important;
  line-height: 1.25 !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
}

.sidebar-toggle,
.topbar-menu-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px !important;
  height: 30px !important;
  padding: 0 !important;
  color: #cbd5e1 !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 8px !important;
  line-height: 1 !important;
}

.topbar-menu-button {
  color: #334155 !important;
  background: #ffffff !important;
  border-color: var(--console-line) !important;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus,
.topbar-menu-button:hover,
.topbar-menu-button:focus {
  color: #ffffff !important;
  background: var(--console-primary) !important;
  border-color: var(--console-primary) !important;
}

.nav {
  display: grid !important;
  gap: 2px !important;
  padding: 12px 0 24px !important;
}

.nav-group-label {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: 28px !important;
  margin: 10px 8px 2px !important;
  color: #8fa0b7 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

.nav-group-label span {
  color: #8091a8 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

.nav a,
.nav-disabled-link {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  height: 40px !important;
  min-height: 40px !important;
  margin: 0 !important;
  padding: 0 12px !important;
  color: var(--console-sidebar-muted) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  text-align: left !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  cursor: pointer !important;
}

.nav-disabled-link {
  opacity: 0.54 !important;
  cursor: help !important;
}

.nav a::before,
.nav-disabled-link::before {
  content: attr(data-short) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 20px !important;
  height: 20px !important;
  flex: 0 0 20px !important;
  color: #dbeafe !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border-radius: 6px !important;
}

.nav a:hover,
.nav-disabled-link:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

.nav a.active {
  color: #ffffff !important;
  background: var(--console-sidebar-active) !important;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24) !important;
}

.nav a.active::before {
  color: var(--console-primary) !important;
  background: #ffffff !important;
}

.main {
  min-height: 100vh !important;
  margin-left: var(--sidebar-width) !important;
  background: var(--console-bg) !important;
  transition: margin-left 0.18s ease, width 0.18s ease !important;
}

.topbar.ruoyi-topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 60 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: 48px !important;
  min-height: 48px !important;
  padding: 0 16px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  border-bottom: 1px solid var(--console-line) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  backdrop-filter: blur(10px);
}

.topbar-left,
.topbar-right {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0 !important;
}

.topbar-title-stack {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0 !important;
}

.topbar-breadcrumb {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  color: #64748b !important;
  font-size: 12px !important;
}

.topbar-breadcrumb a {
  color: #2563eb !important;
  text-decoration: none !important;
}

.topbar h1 {
  margin: 0 !important;
  color: #0f172a !important;
  font-size: 18px !important;
  line-height: 1.2 !important;
  font-weight: 800 !important;
}

.topbar-right,
.topbar-right span {
  color: #64748b !important;
  font-size: 13px !important;
}

.user-chip {
  display: inline-flex !important;
  align-items: center !important;
  height: 28px !important;
  padding: 0 10px !important;
  color: #334155 !important;
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 999px !important;
  font-weight: 700 !important;
}

.ruoyi-tags-view {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  height: 38px !important;
  padding: 5px 16px !important;
  overflow-x: auto !important;
  background: #ffffff !important;
  border-bottom: 1px solid var(--console-line) !important;
}

.ruoyi-tags-view a {
  display: inline-flex !important;
  align-items: center !important;
  height: 26px !important;
  padding: 0 10px !important;
  color: #475569 !important;
  text-decoration: none !important;
  background: #ffffff !important;
  border: 1px solid #dbe4f0 !important;
  border-radius: 5px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

.ruoyi-tags-view a.active,
.ruoyi-tags-view a:hover {
  color: #1d4ed8 !important;
  background: var(--console-primary-soft) !important;
  border-color: #bfdbfe !important;
}

.content {
  max-width: none !important;
  padding: 14px 16px 28px !important;
}

.ruoyi-task-ribbon {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 8px !important;
  margin: 0 0 12px !important;
  padding: 10px 12px !important;
  background: #ffffff !important;
  border: 1px solid var(--console-line) !important;
  border-radius: 8px !important;
  box-shadow: var(--console-shadow) !important;
}

.ruoyi-task-ribbon > div {
  display: flex !important;
  align-items: center !important;
  min-width: 0 !important;
  gap: 6px !important;
}

.ruoyi-task-ribbon span {
  flex: 0 0 auto !important;
  color: #64748b !important;
  font-size: 12px !important;
}

.ruoyi-task-ribbon strong {
  overflow: hidden !important;
  color: #0f172a !important;
  font-size: 13px !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.settings-hero,
.page-header,
.erp-page-panel,
.panel,
.table-card,
.search-panel {
  margin-bottom: 12px !important;
  padding: 14px 16px !important;
  background: var(--console-card) !important;
  border: 1px solid var(--console-line) !important;
  border-radius: 8px !important;
  box-shadow: var(--console-shadow) !important;
}

.settings-hero,
.page-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  min-height: 72px !important;
}

.settings-hero h2,
.page-header h2,
.page-title,
.panel-title-row h2 {
  margin: 0 !important;
  color: #0f172a !important;
  font-size: 18px !important;
  line-height: 1.35 !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
}

.panel-title-row h2 {
  font-size: 16px !important;
}

.settings-hero p,
.page-header p,
.panel-title-row .muted,
.muted,
.cell-muted {
  color: var(--console-muted) !important;
  font-size: 12px !important;
  line-height: 1.55 !important;
}

.breadcrumb {
  margin-bottom: 4px !important;
  color: #64748b !important;
  font-size: 12px !important;
}

.panel-title-row,
.table-toolbar,
.section-toolbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  margin-bottom: 12px !important;
}

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

.btn,
button.btn,
a.btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 32px !important;
  padding: 0 12px !important;
  color: #334155 !important;
  background: #ffffff !important;
  border: 1px solid #d7e1ee !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease !important;
}

.btn:hover,
button.btn:hover,
a.btn:hover {
  color: #1d4ed8 !important;
  background: #f8fbff !important;
  border-color: #93c5fd !important;
}

.btn.primary,
button.btn.primary,
a.btn.primary {
  color: #ffffff !important;
  background: var(--console-primary) !important;
  border-color: var(--console-primary) !important;
}

.btn.primary:hover,
button.btn.primary:hover,
a.btn.primary:hover {
  color: #ffffff !important;
  background: var(--console-primary-dark) !important;
  border-color: var(--console-primary-dark) !important;
}

.btn.danger,
button.btn.danger,
a.btn.danger {
  color: #ffffff !important;
  background: var(--console-danger) !important;
  border-color: var(--console-danger) !important;
}

.btn.ghost,
button.btn.ghost,
a.btn.ghost {
  color: #334155 !important;
  background: #f8fafc !important;
}

.btn.small,
button.btn.small,
a.btn.small {
  min-height: 28px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
}

.btn:disabled,
button:disabled,
.btn.disabled {
  opacity: 0.52 !important;
  cursor: not-allowed !important;
}

input,
select,
textarea {
  min-height: 32px !important;
  color: #0f172a !important;
  background: #ffffff !important;
  border: 1px solid #d7e1ee !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
  box-shadow: none !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #60a5fa !important;
  outline: 0 !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

select option,
select option:hover,
select option:focus,
select option:active,
select option:checked {
  color: #0f172a !important;
  background: #ffffff !important;
  -webkit-text-fill-color: #0f172a !important;
  text-shadow: none !important;
}

select option:hover,
select option:focus,
select option:active {
  background: #eaf2ff !important;
}

.erp-filter-bar,
.settings-provider-filter,
.material-filter-bar,
.ui-image-filter-bar,
.visual-case-filters,
.run-filter-bar,
.report-filter-bar,
.dashboard-filter-bar,
.admin-user-filter {
  display: grid !important;
  grid-template-columns: minmax(240px, 1.7fr) repeat(auto-fit, minmax(150px, 1fr)) !important;
  gap: 10px !important;
  align-items: end !important;
  margin: 0 0 12px !important;
  padding: 12px !important;
  background: #f8fbff !important;
  border: 1px solid var(--console-soft-line) !important;
  border-radius: 8px !important;
}

.erp-filter-bar label,
.settings-provider-filter label,
.material-filter-bar label,
.ui-image-filter-bar label,
.visual-case-filters label,
.run-filter-bar label,
.report-filter-bar label,
.dashboard-filter-bar label,
.admin-user-filter label {
  display: grid !important;
  gap: 5px !important;
  min-width: 0 !important;
  color: #475569 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

.table-wrap,
.erp-table-wrap {
  width: 100% !important;
  overflow: auto !important;
  background: #ffffff !important;
  border: 1px solid var(--console-line) !important;
  border-radius: 8px !important;
}

.erp-table,
table.erp-table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: #ffffff !important;
}

.erp-table th,
.erp-table td {
  height: 48px !important;
  padding: 8px 12px !important;
  border-bottom: 1px solid var(--console-soft-line) !important;
  color: #26364a !important;
  font-size: 13px !important;
  line-height: 1.45 !important;
  vertical-align: middle !important;
}

.erp-table th {
  height: 40px !important;
  color: #475569 !important;
  background: #f1f5fb !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
}

.erp-table tbody tr {
  transition: background 0.15s ease !important;
}

.erp-table tbody tr:nth-child(even) td {
  background: #fbfdff !important;
}

.erp-table tbody tr:hover td {
  background: #edf5ff !important;
}

.truncate-cell,
.erp-table td {
  max-width: 320px !important;
}

.truncate-cell,
.erp-table .truncate,
.cell-muted {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.empty-state,
.empty-row td {
  color: #64748b !important;
  text-align: center !important;
  background: #fbfdff !important;
}

.status,
.status-pill,
.badge,
.tag,
.pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 22px !important;
  padding: 0 8px !important;
  color: #475569 !important;
  background: #eef2f7 !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

.status-AVAILABLE,
.status-SUCCESS,
.status-ok,
.status-success,
.status-passed,
.status-已启用,
.toggle-switch.is-on {
  color: #047857 !important;
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
}

.status-FAILED,
.status-ERROR,
.status-failed,
.status-error,
.status-BLOCKED {
  color: #b91c1c !important;
  background: #fef2f2 !important;
  border-color: #fecaca !important;
}

.status-QUOTA_EXHAUSTED,
.status-TIMEOUT,
.status-warning,
.status-REVIEW {
  color: #b45309 !important;
  background: #fffbeb !important;
  border-color: #fde68a !important;
}

.status-untested,
.status-UNKNOWN,
.status-disabled,
.status-未启用,
.toggle-switch.is-off {
  color: #64748b !important;
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}

.toggle-switch {
  gap: 7px !important;
  min-height: 26px !important;
  padding: 0 9px !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

.toggle-switch span {
  width: 8px !important;
  height: 8px !important;
  border-radius: 50% !important;
  background: currentColor !important;
}

.erp-client-pagination {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  min-height: 44px !important;
  padding: 10px 0 0 !important;
  color: #64748b !important;
  font-size: 13px !important;
}

.erp-pager-controls {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.erp-pager-size select,
.erp-pager-jump input {
  height: 32px !important;
}

.erp-pager-current {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px !important;
  height: 30px !important;
  color: #ffffff !important;
  background: var(--console-primary) !important;
  border-radius: 6px !important;
  font-weight: 800 !important;
}

.erp-pager-jump {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  color: #64748b !important;
}

.erp-pager-jump input {
  width: 64px !important;
  text-align: center !important;
}

.settings-ai-summary.ai-summary-grid,
.ai-summary-grid {
  display: grid !important;
  grid-template-columns: minmax(190px, 0.8fr) minmax(0, 3fr) minmax(180px, 0.8fr) !important;
  gap: 10px !important;
  align-items: stretch !important;
}

.ai-summary-card,
.ai-role-select {
  min-height: 76px !important;
  padding: 12px !important;
  background: #ffffff !important;
  border: 1px solid var(--console-line) !important;
  border-radius: 8px !important;
}

.ai-summary-card label,
.ai-role-select span {
  display: block !important;
  margin-bottom: 6px !important;
  color: #64748b !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

.ai-summary-card strong {
  color: #0f172a !important;
  font-size: 15px !important;
}

.ai-role-form {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(160px, 1fr)) !important;
  gap: 10px !important;
  min-width: 0 !important;
}

.ai-role-select {
  display: grid !important;
  gap: 6px !important;
  min-width: 0 !important;
}

.ai-role-select select {
  width: 100% !important;
  min-width: 0 !important;
}

.ai-role-select small.ai-role-tip,
.ai-role-select small {
  display: inline-flex !important;
  width: fit-content !important;
  color: #2563eb !important;
  cursor: help !important;
}

.ai-role-select em {
  color: #b45309 !important;
  font-size: 12px !important;
  font-style: normal !important;
}

.ai-role-actions {
  grid-column: 1 / -1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

.ai-role-actions span {
  color: #64748b !important;
  font-size: 12px !important;
  cursor: help !important;
}

.settings-provider-table .settings-provider-actions,
.erp-table td:last-child {
  white-space: nowrap !important;
}

.settings-collapse {
  border: 0 !important;
}

.settings-collapse > summary {
  display: flex !important;
  align-items: center !important;
  min-height: 36px !important;
  color: #0f172a !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  cursor: pointer !important;
}

.settings-collapse > summary::marker {
  color: #2563eb !important;
}

.detail-drawer {
  z-index: 120 !important;
  width: min(680px, calc(100vw - var(--sidebar-width))) !important;
  background: #ffffff !important;
  border-left: 1px solid var(--console-line) !important;
  box-shadow: -18px 0 40px rgba(15, 23, 42, 0.16) !important;
}

.detail-drawer-header {
  min-height: 60px !important;
  padding: 14px 16px !important;
  background: #ffffff !important;
  border-bottom: 1px solid var(--console-line) !important;
}

.detail-drawer-header h2 {
  margin: 0 !important;
  font-size: 17px !important;
  font-weight: 800 !important;
}

.drawer-body {
  padding: 14px 16px !important;
}

.modal-close-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px !important;
  height: 30px !important;
  padding: 0 !important;
  color: #334155 !important;
  background: #f1f5f9 !important;
  border: 1px solid #dbe4f0 !important;
  border-radius: 8px !important;
  font-size: 20px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
  color: #ffffff !important;
  background: var(--console-primary) !important;
  border-color: var(--console-primary) !important;
}

.global-help-tooltip {
  z-index: 14000 !important;
  max-width: min(360px, calc(100vw - 32px)) !important;
  padding: 8px 10px !important;
  color: #ffffff !important;
  background: rgba(15, 23, 42, 0.94) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 6px !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22) !important;
  font-size: 12px !important;
  line-height: 1.6 !important;
  white-space: normal !important;
  pointer-events: none !important;
}

.global-help-tooltip.is-visible {
  opacity: 1 !important;
}

body.sidebar-collapsed {
  --sidebar-width: var(--sidebar-collapsed-width) !important;
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width) !important;
  padding: 12px 8px !important;
}

body.sidebar-collapsed .main,
html body.sidebar-collapsed > .app-shell.ruoyi-shell > .main {
  margin-left: var(--sidebar-collapsed-width) !important;
}

body:not(.sidebar-collapsed) .main,
html body:not(.sidebar-collapsed) > .app-shell.ruoyi-shell > .main {
  margin-left: 200px !important;
}

body.sidebar-collapsed .brand-row {
  justify-content: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.sidebar-collapsed .brand {
  justify-content: center !important;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-group-label {
  display: none !important;
}

body.sidebar-collapsed .sidebar-toggle {
  display: none !important;
}

body.sidebar-collapsed .nav {
  gap: 6px !important;
  padding-top: 14px !important;
}

body.sidebar-collapsed .nav a,
body.sidebar-collapsed .nav-disabled-link {
  justify-content: center !important;
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  height: 40px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  color: transparent !important;
  font-size: 0 !important;
}

body.sidebar-collapsed .nav a::before,
body.sidebar-collapsed .nav-disabled-link::before {
  margin: 0 !important;
}

body.sidebar-collapsed .nav a::after,
body.sidebar-collapsed .nav-disabled-link::after,
body.sidebar-collapsed .nav a.nav-advanced-link::after {
  display: none !important;
  content: none !important;
}

body.sidebar-collapsed .nav a.active {
  background: var(--console-primary) !important;
}

@media (max-width: 1180px) {
  .settings-ai-summary.ai-summary-grid,
  .ai-summary-grid {
    grid-template-columns: 1fr !important;
  }

  .ai-role-form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .ruoyi-task-ribbon {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 860px) {
  :root {
    --sidebar-width: 0px !important;
  }

  .sidebar {
    transform: translateX(-100%) !important;
  }

  body:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0) !important;
    width: 200px !important;
  }

  body.sidebar-collapsed .sidebar {
    transform: translateX(-100%) !important;
  }

  .main,
  body:not(.sidebar-collapsed) .main,
  body.sidebar-collapsed .main {
    margin-left: 0 !important;
  }

  .settings-hero,
  .page-header,
  .panel-title-row {
    align-items: flex-start !important;
    flex-direction: column !important;
  }

  .erp-filter-bar,
  .settings-provider-filter,
  .material-filter-bar,
  .ui-image-filter-bar,
  .visual-case-filters,
  .run-filter-bar,
  .report-filter-bar,
  .dashboard-filter-bar,
  .admin-user-filter,
  .ai-role-form,
  .ruoyi-task-ribbon {
    grid-template-columns: 1fr !important;
  }

  .topbar-breadcrumb,
  .ruoyi-tags-view {
    display: none !important;
  }

  .content {
    padding: 10px !important;
  }

  .detail-drawer {
    width: calc(100vw - 12px) !important;
  }
}

/* v0.10.1 compact ERP polish: settings/admin visual refinement only. */
:root {
  --erp-control-height: 32px;
  --erp-table-action-height: 28px;
  --erp-border: #dcdfe6;
  --erp-border-soft: #e8edf5;
  --erp-header-bg: #f5f7fa;
  --erp-hover-bg: #f5f9ff;
}

.topbar.ruoyi-topbar {
  height: 48px !important;
  min-height: 48px !important;
}

.sidebar {
  padding-top: 10px !important;
}

.nav a,
.nav-disabled-link {
  height: 40px !important;
  min-height: 40px !important;
  gap: 8px !important;
  color: #c5d1e3 !important;
}

.nav a:not(.active):hover,
.nav-disabled-link:hover {
  color: #ffffff !important;
}

.nav-group-label {
  height: 24px !important;
  margin-top: 8px !important;
  color: #8798ae !important;
  font-size: 11px !important;
}

.settings-hero,
.admin-page-head {
  min-height: 66px !important;
  padding: 13px 16px !important;
  border-radius: 6px !important;
}

.settings-hero h2,
.admin-page-head h2 {
  font-size: 18px !important;
}

.settings-hero p,
.admin-page-head p,
.admin-page-subtitle {
  margin: 4px 0 0 !important;
  color: #687789 !important;
  font-size: 12px !important;
}

.panel,
.table-card,
.search-panel {
  padding: 14px 16px !important;
  border-radius: 6px !important;
}

.panel-title-row {
  margin-bottom: 10px !important;
}

.panel-title-row h2 {
  font-size: 16px !important;
}

.panel-title-row .muted,
.settings-provider-panel .muted,
.ai-config-center .muted {
  font-size: 12px !important;
}

input,
select,
textarea,
.form-control-sm {
  min-height: var(--erp-control-height) !important;
  height: var(--erp-control-height) !important;
  padding: 0 10px !important;
  color: #303133 !important;
  background: #ffffff !important;
  border-color: var(--erp-border) !important;
  border-radius: 4px !important;
  font-size: 13px !important;
}

textarea {
  height: auto !important;
  min-height: 72px !important;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #409eff !important;
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.12) !important;
}

select option,
select option:hover,
select option:focus,
select option:active,
select option:checked {
  color: #303133 !important;
  background-color: #ffffff !important;
  -webkit-text-fill-color: #303133 !important;
}

select option:hover,
select option:focus,
select option:active {
  color: #1f2d3d !important;
  background-color: #ecf5ff !important;
}

.btn,
button.btn,
a.btn,
.btn-sm {
  min-height: var(--erp-control-height) !important;
  height: var(--erp-control-height) !important;
  padding: 0 12px !important;
  border-radius: 4px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

.btn.small,
button.btn.small,
a.btn.small,
.erp-table .btn,
.admin-user-actions .btn,
.settings-provider-actions .btn {
  min-height: var(--erp-table-action-height) !important;
  height: var(--erp-table-action-height) !important;
  padding: 0 9px !important;
  border-radius: 4px !important;
  font-size: 12px !important;
}

.btn.primary,
button.btn.primary,
a.btn.primary {
  background: #2563eb !important;
  border-color: #2563eb !important;
}

.btn:not(.primary):not(.danger),
button.btn:not(.primary):not(.danger),
a.btn:not(.primary):not(.danger) {
  color: #475569 !important;
  background: #ffffff !important;
  border-color: var(--erp-border) !important;
}

.btn:not(.primary):not(.danger):hover,
button.btn:not(.primary):not(.danger):hover,
a.btn:not(.primary):not(.danger):hover {
  color: #2563eb !important;
  background: #f8fbff !important;
  border-color: #93c5fd !important;
}

.settings-provider-filter,
.admin-user-filter,
.erp-filter-bar.settings-provider-filter,
.erp-filter-bar.admin-user-filter {
  display: flex !important;
  align-items: flex-end !important;
  flex-wrap: wrap !important;
  gap: 10px 12px !important;
  margin: 0 0 12px !important;
  padding: 12px !important;
  background: #ffffff !important;
  border: 1px solid var(--erp-border-soft) !important;
  border-radius: 6px !important;
}

.settings-provider-filter label,
.admin-user-filter label {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 8px !important;
  width: auto !important;
  min-width: 0 !important;
  color: #606266 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

.settings-provider-filter input,
.settings-provider-filter select,
.admin-user-filter input,
.admin-user-filter select {
  width: 200px !important;
  max-width: 220px !important;
}

.settings-provider-filter label:first-child input,
.admin-user-filter label:first-child input {
  width: 240px !important;
  max-width: 260px !important;
}

.settings-provider-filter > .btn,
.settings-provider-filter > button,
.admin-user-filter > .btn,
.admin-user-filter > button {
  width: auto !important;
  min-width: 64px !important;
  flex: 0 0 auto !important;
}

.table-wrap,
.erp-table-wrap,
.admin-user-table-wrap {
  border-color: var(--erp-border-soft) !important;
  border-radius: 6px !important;
}

.erp-table th,
.erp-table td {
  height: 46px !important;
  padding: 7px 10px !important;
  border-bottom-color: #ebeef5 !important;
  font-size: 13px !important;
}

.erp-table th {
  height: 40px !important;
  color: #606266 !important;
  background: var(--erp-header-bg) !important;
  font-weight: 700 !important;
}

.erp-table tbody tr:nth-child(even) td {
  background: #ffffff !important;
}

.erp-table tbody tr:hover td {
  background: var(--erp-hover-bg) !important;
}

.erp-table td,
.truncate-cell,
.cell-muted {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.cell-muted {
  max-width: 280px !important;
  color: #909399 !important;
  font-size: 12px !important;
}

.status,
.status-pill,
.badge,
.tag,
.pill {
  min-height: 20px !important;
  padding: 0 7px !important;
  border-radius: 10px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

.status-pill.primary {
  color: #1d4ed8 !important;
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
}

.status-pill.success {
  color: #059669 !important;
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
}

.status-pill.danger {
  color: #dc2626 !important;
  background: #fef2f2 !important;
  border-color: #fecaca !important;
}

.status-MODEL_NOT_FOUND,
.status-QUOTA_EXHAUSTED,
.status-warning {
  color: #c2410c !important;
  background: #fff7ed !important;
  border-color: #fed7aa !important;
}

.toggle-switch {
  min-height: 24px !important;
  height: 24px !important;
  padding: 0 8px !important;
  border-radius: 12px !important;
  font-size: 12px !important;
}

.settings-ai-summary.ai-summary-grid {
  grid-template-columns: 190px minmax(0, 1fr) 170px !important;
  gap: 10px !important;
}

.settings-ai-summary .ai-summary-card,
.settings-ai-summary .ai-role-select {
  min-height: 70px !important;
  padding: 10px !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}

.settings-ai-summary .ai-role-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr)) !important;
  gap: 8px !important;
}

.settings-ai-summary .ai-role-select span,
.settings-ai-summary .ai-summary-card label {
  margin-bottom: 4px !important;
  color: #606266 !important;
  font-size: 12px !important;
}

.settings-ai-summary .ai-role-select small.ai-role-tip {
  margin-top: 0 !important;
  color: #409eff !important;
  font-size: 12px !important;
}

.settings-provider-table th:nth-child(1),
.settings-provider-table td:nth-child(1) {
  width: 170px !important;
}

.settings-provider-table th:nth-child(2),
.settings-provider-table td:nth-child(2) {
  max-width: 340px !important;
}

.settings-provider-table th:last-child,
.settings-provider-table td:last-child {
  width: 116px !important;
}

.settings-provider-table .link-button {
  color: #2563eb !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

.admin-page {
  display: grid !important;
  gap: 12px !important;
}

.admin-page-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  background: #ffffff !important;
  border: 1px solid var(--erp-border-soft) !important;
  box-shadow: var(--console-shadow) !important;
}

.admin-metric-strip {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(96px, 1fr)) !important;
  gap: 8px !important;
  margin: 0 !important;
}

.admin-metric {
  min-height: 54px !important;
  padding: 9px 12px !important;
  background: #ffffff !important;
  border: 1px solid var(--erp-border-soft) !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}

.admin-metric.primary,
.admin-metric.warning {
  background: #ffffff !important;
}

.admin-metric span {
  color: #606266 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

.admin-metric strong {
  margin-top: 4px !important;
  color: #2563eb !important;
  font-size: 20px !important;
  line-height: 1.1 !important;
}

.admin-metric.warning strong {
  color: #d97706 !important;
}

.admin-register-panel {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  min-height: 54px !important;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

.admin-register-copy h3 {
  margin: 0 !important;
  font-size: 15px !important;
}

.admin-register-form {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.admin-user-panel .panel-title-row {
  border-bottom: 1px solid var(--erp-border-soft) !important;
  padding-bottom: 10px !important;
}

.admin-user-table th:first-child,
.admin-user-table td:first-child {
  width: 72px !important;
}

.admin-user-table th:nth-child(2),
.admin-user-table td:nth-child(2) {
  width: 180px !important;
}

.admin-user-table th:nth-child(6),
.admin-user-table td:nth-child(6) {
  max-width: 220px !important;
}

.admin-user-table th:last-child,
.admin-user-table td:last-child {
  width: 138px !important;
  text-align: right !important;
}

.admin-user-actions {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 6px !important;
}

.admin-log-panel {
  margin-top: 0 !important;
}

.info-tip {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 16px !important;
  height: 16px !important;
  padding: 0 !important;
  color: #2563eb !important;
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  border-radius: 50% !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

.title-with-tip {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.erp-client-pagination {
  min-height: 38px !important;
  padding-top: 8px !important;
}

.erp-pager-size select,
.erp-pager-jump input {
  height: 30px !important;
  min-height: 30px !important;
}

.erp-pager-current {
  width: 28px !important;
  height: 28px !important;
  border-radius: 4px !important;
}

.modal-panel.compact-modal-panel,
.admin-action-modal {
  border-radius: 8px !important;
}

.admin-modal-form label {
  color: #606266 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

@media (max-width: 1320px) {
  .settings-ai-summary.ai-summary-grid {
    grid-template-columns: 1fr !important;
  }

  .settings-ai-summary .ai-role-form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 1080px) {
  .admin-metric-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 860px) {
  .settings-provider-filter label,
  .admin-user-filter label {
    grid-template-columns: 1fr !important;
    width: 100% !important;
  }

  .settings-provider-filter input,
  .settings-provider-filter select,
  .admin-user-filter input,
  .admin-user-filter select,
  .settings-provider-filter label:first-child input,
  .admin-user-filter label:first-child input {
    width: 100% !important;
    max-width: none !important;
  }

  .admin-metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .admin-register-panel,
  .admin-page-head {
    align-items: flex-start !important;
    flex-direction: column !important;
  }
}

/* v0.10.2 sitewide ERP normalization: compact query bars, table-first pages, unified status/switch controls. */
:root {
  --erp-blue: #2563eb;
  --erp-blue-hover: #1d4ed8;
  --erp-green: #059669;
  --erp-red: #dc2626;
  --erp-orange: #d97706;
  --erp-text: #1f2937;
  --erp-muted: #6b7280;
  --erp-line: #d9e2ef;
  --erp-line-soft: #e8eef7;
  --erp-bg-soft: #f3f6fb;
  --erp-head-bg: #f5f7fa;
  --erp-control-height: 32px;
  --erp-action-height: 28px;
  --erp-radius: 4px;
}

html,
body {
  color: var(--erp-text) !important;
}

.page-header,
.task-context-bar,
.settings-hero,
.admin-page-head {
  min-height: auto !important;
  padding: 14px 16px !important;
  border: 1px solid var(--erp-line-soft) !important;
  border-radius: 6px !important;
  background: #fff !important;
  box-shadow: 0 1px 2px rgb(15 23 42 / 5%) !important;
}

.page-header h1,
.page-header h2,
.task-context-bar h1,
.task-context-bar h2,
.settings-hero h2,
.admin-page-head h2 {
  margin: 0 !important;
  color: #111827 !important;
  font-size: 18px !important;
  line-height: 1.35 !important;
  font-weight: 700 !important;
}

.page-subtitle,
.task-context-bar .muted,
.settings-hero p,
.admin-page-subtitle,
.panel-title-row .muted {
  margin-top: 4px !important;
  color: var(--erp-muted) !important;
  font-size: 12px !important;
  line-height: 1.55 !important;
}

.panel,
.table-card,
.panel-card,
.summary-card {
  border: 1px solid var(--erp-line-soft) !important;
  border-radius: 6px !important;
  background: #fff !important;
  box-shadow: 0 1px 2px rgb(15 23 42 / 4%) !important;
}

.panel {
  padding: 14px 16px !important;
}

.panel-title-row,
.table-toolbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  margin-bottom: 10px !important;
}

.panel-title-row h2,
.table-toolbar h2,
.panel h2 {
  color: #111827 !important;
  font-size: 16px !important;
  line-height: 1.35 !important;
}

.actions,
.page-actions,
.table-actions,
.query-actions,
.row-actions,
.admin-user-actions,
.settings-provider-actions,
.material-actions,
.ui-image-actions {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
}

.btn,
button.btn,
a.btn,
.btn-secondary {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: var(--erp-control-height) !important;
  height: var(--erp-control-height) !important;
  padding: 0 12px !important;
  border: 1px solid var(--erp-line) !important;
  border-radius: var(--erp-radius) !important;
  background: #fff !important;
  color: #334155 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  text-decoration: none !important;
  white-space: nowrap !important;
}

.btn:hover,
a.btn:hover,
button.btn:hover {
  border-color: #b8c7dc !important;
  background: #f8fafc !important;
  color: #1e293b !important;
}

.btn.primary,
.btn-primary {
  border-color: var(--erp-blue) !important;
  background: var(--erp-blue) !important;
  color: #fff !important;
}

.btn.primary:hover,
.btn-primary:hover {
  border-color: var(--erp-blue-hover) !important;
  background: var(--erp-blue-hover) !important;
  color: #fff !important;
}

.btn.danger,
.btn-danger {
  border-color: #fca5a5 !important;
  background: #fff !important;
  color: var(--erp-red) !important;
}

.btn.danger:hover,
.btn-danger:hover {
  border-color: var(--erp-red) !important;
  background: #fef2f2 !important;
  color: #b91c1c !important;
}

.btn.small,
.btn.sm,
.btn-sm,
.erp-table .btn,
.data-table .btn,
table .btn {
  min-height: var(--erp-action-height) !important;
  height: var(--erp-action-height) !important;
  padding: 0 9px !important;
  border-radius: var(--erp-radius) !important;
  font-size: 12px !important;
}

.link-button,
.btn-link {
  color: var(--erp-blue) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
}

.link-button:hover,
.btn-link:hover {
  color: var(--erp-blue-hover) !important;
  text-decoration: underline !important;
}

input,
select,
textarea,
.form-control,
.form-select,
.query-control {
  border: 1px solid var(--erp-line) !important;
  border-radius: var(--erp-radius) !important;
  background-color: #fff !important;
  color: var(--erp-text) !important;
  font-size: 13px !important;
  box-shadow: none !important;
}

input,
select,
.form-control,
.form-select {
  min-height: var(--erp-control-height) !important;
  height: var(--erp-control-height) !important;
  padding: 0 10px !important;
}

textarea {
  padding: 8px 10px !important;
  line-height: 1.5 !important;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.form-select:focus {
  border-color: #409eff !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgb(64 158 255 / 12%) !important;
}

select option,
select option:hover,
select option:checked {
  background: #fff !important;
  color: var(--erp-text) !important;
}

.form-control-sm,
.form-select-sm,
.compact-input {
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 8px !important;
  font-size: 12px !important;
}

.query-panel,
.erp-filter-bar,
.dashboard-filter-bar,
.task-filter-bar,
.material-filter-bar,
.ui-image-filter-bar,
.execution-filter-bar,
.report-filter-bar,
.ai-output-filter-bar,
.prompt-filter-bar,
.settings-provider-filter,
.admin-user-filter {
  display: flex !important;
  align-items: end !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
  margin: 10px 0 12px !important;
  padding: 12px !important;
  border: 1px solid var(--erp-line-soft) !important;
  border-radius: 6px !important;
  background: #fff !important;
  box-shadow: none !important;
}

.query-form {
  display: flex !important;
  align-items: end !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
}

.query-item,
.erp-filter-bar label,
.dashboard-filter-bar label,
.task-filter-bar label,
.material-filter-bar label,
.ui-image-filter-bar label,
.execution-filter-bar label,
.report-filter-bar label,
.ai-output-filter-bar label,
.prompt-filter-bar label,
.settings-provider-filter label,
.admin-user-filter label {
  display: grid !important;
  grid-template-columns: auto minmax(160px, 220px) !important;
  align-items: center !important;
  gap: 7px !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  color: #475569 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
}

.erp-filter-bar label.search-box,
.dashboard-filter-bar label.search-box,
.material-filter-bar label.search-box,
.ui-image-filter-bar label.search-box,
.execution-filter-bar label.search-box,
.report-filter-bar label.search-box,
.ai-output-filter-bar label.search-box {
  grid-template-columns: auto minmax(210px, 260px) !important;
}

.query-label {
  color: #475569 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

.erp-filter-bar input,
.erp-filter-bar select,
.dashboard-filter-bar input,
.dashboard-filter-bar select,
.task-filter-bar input,
.task-filter-bar select,
.material-filter-bar input,
.material-filter-bar select,
.ui-image-filter-bar input,
.ui-image-filter-bar select,
.execution-filter-bar input,
.execution-filter-bar select,
.report-filter-bar input,
.report-filter-bar select,
.ai-output-filter-bar input,
.ai-output-filter-bar select,
.prompt-filter-bar input,
.prompt-filter-bar select,
.settings-provider-filter input,
.settings-provider-filter select,
.admin-user-filter input,
.admin-user-filter select {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
}

.query-actions,
.erp-filter-bar > .actions,
.execution-filter-bar > .actions {
  align-self: end !important;
}

.table-card,
.table-wrap {
  border: 1px solid var(--erp-line-soft) !important;
  border-radius: 6px !important;
  background: #fff !important;
  overflow: auto !important;
  box-shadow: none !important;
}

table.erp-table,
.erp-table,
.data-table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: #fff !important;
  color: var(--erp-text) !important;
}

.erp-table th,
.erp-table td,
.data-table th,
.data-table td {
  border-right: 0 !important;
  border-bottom: 1px solid var(--erp-line-soft) !important;
  vertical-align: middle !important;
}

.erp-table th,
.data-table th {
  height: 42px !important;
  padding: 8px 10px !important;
  background: var(--erp-head-bg) !important;
  color: #606266 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  white-space: nowrap !important;
}

.erp-table td,
.data-table td {
  height: 46px !important;
  padding: 8px 10px !important;
  color: #334155 !important;
  font-size: 13px !important;
  line-height: 1.45 !important;
}

.erp-table tbody tr:hover td,
.data-table tbody tr:hover td {
  background: #f5f9ff !important;
}

.truncate-cell,
.erp-table td,
.data-table td {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.cell-muted,
.muted {
  color: var(--erp-muted) !important;
  font-size: 12px !important;
}

.empty-state {
  padding: 24px 16px !important;
  color: var(--erp-muted) !important;
  text-align: center !important;
}

.empty-state strong {
  color: #475569 !important;
  font-size: 14px !important;
}

.status-badge,
.status,
.status-pill,
.status-success,
.status-warning,
.status-danger,
.status-muted,
.status-info {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 0 !important;
  height: 22px !important;
  padding: 0 8px !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.status-badge.success,
.status-success,
.status.READY,
.status.status-AVAILABLE,
.status-AVAILABLE,
.status-DONE,
.status.LINKED,
.status.saved {
  border: 1px solid #bbf7d0 !important;
  background: #ecfdf5 !important;
  color: var(--erp-green) !important;
}

.status-badge.muted,
.status-muted,
.status.untested,
.status.unlinked,
.status.UNKNOWN,
.status-PENDING {
  border: 1px solid #e5e7eb !important;
  background: #f3f4f6 !important;
  color: #64748b !important;
}

.status-badge.warning,
.status-warning,
.status-MODEL_NOT_FOUND,
.status-QUOTA_EXHAUSTED,
.status.warn,
.status.REVIEW,
.status.PENDING_CONFIRM {
  border: 1px solid #fed7aa !important;
  background: #fff7ed !important;
  color: var(--erp-orange) !important;
}

.status-badge.danger,
.status-danger,
.status-FAILED,
.status-ERROR,
.status-BLOCKED,
.status.danger,
.status.ERROR,
.status.FAIL {
  border: 1px solid #fecaca !important;
  background: #fef2f2 !important;
  color: var(--erp-red) !important;
}

.status-badge.info,
.status-info,
.status-RUNNING,
.status.RUNNING,
.status.CONTINUE {
  border: 1px solid #bfdbfe !important;
  background: #eff6ff !important;
  color: var(--erp-blue) !important;
}

.status-switch-form {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  margin: 0 !important;
  white-space: nowrap !important;
}

.status-switch {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  width: 36px !important;
  min-width: 36px !important;
  height: 20px !important;
  min-height: 20px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: #cbd5e1 !important;
  box-shadow: inset 0 0 0 1px rgb(15 23 42 / 8%) !important;
  cursor: pointer !important;
}

.status-switch span {
  position: absolute !important;
  left: 2px !important;
  top: 2px !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 50% !important;
  background: #fff !important;
  box-shadow: 0 1px 2px rgb(15 23 42 / 25%) !important;
  transition: transform .16s ease !important;
}

.status-switch.is-on {
  background: #22c55e !important;
}

.status-switch.is-on span {
  transform: translateX(16px) !important;
}

.toggle-switch {
  width: 42px !important;
  min-width: 42px !important;
  height: 22px !important;
  min-height: 22px !important;
  overflow: hidden !important;
  text-indent: -9999px !important;
  color: transparent !important;
}

.settings-provider-table .status-switch-form {
  min-width: 96px !important;
}

.erp-client-pagination,
.erp-pagination,
.pagination {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  min-height: 38px !important;
  padding: 8px 0 0 !important;
  color: var(--erp-muted) !important;
  font-size: 13px !important;
}

.erp-pager-size select,
.erp-pager-jump input,
.pagination select,
.pagination input {
  height: 30px !important;
  min-height: 30px !important;
}

.app-sidebar .nav-link,
.sidebar .nav-link {
  min-height: 40px !important;
  gap: 8px !important;
  color: #cbd5e1 !important;
  font-size: 14px !important;
}

.app-sidebar .nav-link.active,
.sidebar .nav-link.active {
  background: #2563eb !important;
  color: #fff !important;
}

.app-sidebar .section-title,
.sidebar .section-title,
.nav-section-title {
  color: #94a3b8 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .section-title,
body.sidebar-collapsed .nav-section-title {
  display: none !important;
}

body.sidebar-collapsed .app-sidebar .nav-link,
body.sidebar-collapsed .sidebar .nav-link {
  justify-content: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.modal-close-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  border-radius: 6px !important;
  font-size: 20px !important;
  line-height: 1 !important;
}

@media (max-width: 1100px) {
  .query-item,
  .erp-filter-bar label,
  .dashboard-filter-bar label,
  .task-filter-bar label,
  .material-filter-bar label,
  .ui-image-filter-bar label,
  .execution-filter-bar label,
  .report-filter-bar label,
  .ai-output-filter-bar label,
  .prompt-filter-bar label,
  .settings-provider-filter label,
  .admin-user-filter label {
    grid-template-columns: 1fr !important;
    align-items: start !important;
  }
}

/* v0.10.4 screenshot-defect hotfix: compact query actions and readable table operation columns. */
.erp-filter-bar,
.task-filter-bar,
.admin-user-filter,
.settings-provider-filter,
.report-filter-bar,
.run-filter-bar,
.codex-filter-bar,
.visual-case-filters,
.dashboard-filter-bar,
.material-filter-bar,
.ui-image-filter-bar,
.execution-filter-bar,
.ai-output-filter-bar,
.prompt-filter-bar,
.upload-command-bar {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: end !important;
  gap: 10px 12px !important;
  width: 100% !important;
}

.erp-filter-bar label,
.task-filter-bar label,
.admin-user-filter label,
.settings-provider-filter label,
.report-filter-bar label,
.run-filter-bar label,
.codex-filter-bar label,
.visual-case-filters label,
.dashboard-filter-bar label,
.material-filter-bar label,
.ui-image-filter-bar label,
.execution-filter-bar label,
.ai-output-filter-bar label,
.prompt-filter-bar label,
.upload-command-bar label {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 0 1 220px !important;
  min-width: 180px !important;
  max-width: 280px !important;
  white-space: nowrap !important;
}

.erp-filter-bar input,
.erp-filter-bar select,
.task-filter-bar input,
.task-filter-bar select,
.admin-user-filter input,
.admin-user-filter select,
.settings-provider-filter input,
.settings-provider-filter select,
.report-filter-bar input,
.report-filter-bar select,
.run-filter-bar input,
.run-filter-bar select,
.codex-filter-bar input,
.codex-filter-bar select,
.visual-case-filters input,
.visual-case-filters select,
.dashboard-filter-bar input,
.dashboard-filter-bar select,
.material-filter-bar input,
.material-filter-bar select,
.ui-image-filter-bar input,
.ui-image-filter-bar select,
.execution-filter-bar input,
.execution-filter-bar select,
.ai-output-filter-bar input,
.ai-output-filter-bar select,
.prompt-filter-bar input,
.prompt-filter-bar select,
.upload-command-bar input,
.upload-command-bar select {
  width: 100% !important;
  min-width: 0 !important;
}

.query-actions,
.erp-filter-bar > .actions,
.execution-filter-bar > .actions,
.upload-actions {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  width: auto !important;
  min-width: 0 !important;
  align-self: end !important;
  white-space: nowrap !important;
}

.erp-filter-bar > .btn,
.erp-filter-bar > button,
.task-filter-bar > .btn,
.task-filter-bar > button,
.admin-user-filter > .btn,
.admin-user-filter > button,
.settings-provider-filter > .btn,
.settings-provider-filter > button,
.report-filter-bar > .btn,
.report-filter-bar > button,
.run-filter-bar > .btn,
.run-filter-bar > button,
.codex-filter-bar > .btn,
.codex-filter-bar > button,
.visual-case-filters > .btn,
.visual-case-filters > button,
.dashboard-filter-bar > .btn,
.dashboard-filter-bar > button,
.material-filter-bar > .btn,
.material-filter-bar > button,
.ui-image-filter-bar > .btn,
.ui-image-filter-bar > button,
.execution-filter-bar > .btn,
.execution-filter-bar > button,
.ai-output-filter-bar > .btn,
.ai-output-filter-bar > button,
.prompt-filter-bar > .btn,
.prompt-filter-bar > button,
.upload-command-bar > .btn,
.upload-command-bar > button,
.query-actions .btn,
.query-actions button,
.erp-filter-bar > .actions .btn,
.erp-filter-bar > .actions button,
.execution-filter-bar > .actions .btn,
.execution-filter-bar > .actions button {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 64px !important;
  max-width: 96px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 12px !important;
  white-space: nowrap !important;
}

.upload-actions .btn,
.upload-actions button,
.upload-command-bar > .btn.primary,
.upload-command-bar > button.primary,
.apk-upload-form .btn.primary {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 96px !important;
  max-width: 120px !important;
  height: 32px !important;
}

.upload-command-bar label:has(input[type="file"]) {
  flex-basis: 360px !important;
  max-width: 520px !important;
}

.apk-upload-form {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  margin: 12px 0 0 !important;
  padding: 12px !important;
  border: 1px solid var(--erp-line-soft) !important;
  border-radius: 6px !important;
  background: #f8fafc !important;
}

.apk-upload-form input[type="file"] {
  flex: 1 1 360px !important;
  max-width: 520px !important;
  height: 32px !important;
}

.erp-table th:last-child,
.erp-table td:last-child,
.data-table th:last-child,
.data-table td:last-child,
.project-actions,
.task-row-actions,
.workbench-task-actions,
.material-actions,
.ui-image-actions,
.admin-user-actions,
.settings-provider-actions,
.row-actions,
.table-actions,
.apk-actions {
  overflow: visible !important;
  max-width: none !important;
  white-space: nowrap !important;
}

.project-actions,
.task-row-actions,
.workbench-task-actions,
.material-actions,
.ui-image-actions,
.admin-user-actions,
.settings-provider-actions,
.row-actions,
.table-actions,
.apk-actions {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
  min-width: max-content !important;
  vertical-align: middle !important;
}

.project-actions .btn,
.task-row-actions .btn,
.workbench-task-actions .btn,
.material-actions .btn,
.ui-image-actions .btn,
.admin-user-actions .btn,
.settings-provider-actions .btn,
.row-actions .btn,
.table-actions .btn,
.apk-actions .btn {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 48px !important;
  max-width: none !important;
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 10px !important;
  overflow: visible !important;
  text-indent: 0 !important;
}

.project-actions .btn.primary,
.task-row-actions .btn.primary,
.workbench-task-actions .btn.primary,
.material-actions .btn.primary,
.ui-image-actions .btn.primary,
.admin-user-actions .btn.primary,
.settings-provider-actions .btn.primary,
.row-actions .btn.primary,
.table-actions .btn.primary,
.apk-actions .btn.primary {
  color: #fff !important;
}

.project-table th:last-child,
.project-table td:last-child,
.task-list-table th:last-child,
.task-list-table td:last-child,
.workbench-task-table th:last-child,
.workbench-task-table td:last-child,
.materials-table th:last-child,
.materials-table td:last-child,
.ui-image-table th:last-child,
.ui-image-table td:last-child,
.admin-user-table th:last-child,
.admin-user-table td:last-child,
.settings-provider-table th:last-child,
.settings-provider-table td:last-child,
.apk-analysis-table th:last-child,
.apk-analysis-table td:last-child {
  width: 150px !important;
  min-width: 150px !important;
}

.visual-case-table th:last-child,
.visual-case-table td:last-child,
.case-table th:last-child,
.case-table td:last-child,
#visual-case-table th:last-child,
#visual-case-table td:last-child {
  width: 300px !important;
  min-width: 300px !important;
}

.erp-case-row .row-actions {
  min-width: 286px !important;
}

.erp-case-row .case-updated-at {
  width: 140px !important;
  min-width: 140px !important;
}

.apk-analysis-table th:nth-child(10),
.apk-analysis-table td:nth-child(10) {
  width: 270px !important;
  min-width: 270px !important;
}

.apk-analysis-table th:last-child,
.apk-analysis-table td:last-child {
  width: 270px !important;
  min-width: 270px !important;
}

@media (max-width: 760px) {
  .erp-filter-bar label,
  .task-filter-bar label,
  .admin-user-filter label,
  .settings-provider-filter label,
  .report-filter-bar label,
  .run-filter-bar label,
  .codex-filter-bar label,
  .visual-case-filters label,
  .dashboard-filter-bar label,
  .material-filter-bar label,
  .ui-image-filter-bar label,
  .execution-filter-bar label,
  .ai-output-filter-bar label,
  .prompt-filter-bar label,
  .upload-command-bar label {
    flex: 1 1 100% !important;
    max-width: none !important;
  }

  .query-actions,
  .erp-filter-bar > .actions,
  .execution-filter-bar > .actions,
  .upload-actions {
    width: 100% !important;
  }
}

/* v0.10.5 screenshot hotfix: collapsed sidebar icons and table action alignment. */
.nav a,
.nav-disabled-link {
  display: flex !important;
  align-items: center !important;
}

.nav a::before,
.nav-disabled-link::before,
.nav a::after,
.nav-disabled-link::after,
.nav a.nav-advanced-link::after {
  content: none !important;
  display: none !important;
}

.nav-icon,
.menu-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 24px !important;
  min-width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  border-radius: 6px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
  overflow: visible !important;
  text-indent: 0 !important;
}

.nav a.active .nav-icon {
  background: #ffffff !important;
  color: #2563eb !important;
}

.nav a:not(.active):hover .nav-icon,
.nav-disabled-link:hover .nav-icon {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #ffffff !important;
}

body.sidebar-collapsed {
  --sidebar-width: 64px !important;
  --sidebar-collapsed-width: 64px !important;
}

body.sidebar-collapsed .sidebar {
  width: 64px !important;
  padding: 12px 8px !important;
  overflow-x: hidden !important;
}

body.sidebar-collapsed .main,
html body.sidebar-collapsed > .app-shell.ruoyi-shell > .main {
  margin-left: 64px !important;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .menu-text,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .menu-group-title,
body.sidebar-collapsed .nav-group-label {
  display: none !important;
}

body.sidebar-collapsed .brand-row,
body.sidebar-collapsed .brand {
  justify-content: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.sidebar-collapsed .sidebar-toggle {
  display: none !important;
}

body.sidebar-collapsed .nav {
  align-items: center !important;
  gap: 6px !important;
  padding-top: 12px !important;
}

body.sidebar-collapsed .nav a,
body.sidebar-collapsed .nav-disabled-link {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  margin: 4px auto !important;
  padding: 0 !important;
  color: #cbd5e1 !important;
  line-height: 1 !important;
  overflow: visible !important;
  text-indent: 0 !important;
}

body.sidebar-collapsed .nav a.active {
  background: #2563eb !important;
  color: #ffffff !important;
}

body.sidebar-collapsed .nav a.active .nav-icon {
  background: transparent !important;
  color: #ffffff !important;
}

body.sidebar-collapsed .nav a:not(.active) .nav-icon,
body.sidebar-collapsed .nav-disabled-link .nav-icon {
  background: transparent !important;
  color: #cbd5e1 !important;
}

.erp-table th,
.erp-table td,
.data-table th,
.data-table td {
  vertical-align: middle !important;
}

.erp-table th.col-actions,
.erp-table td.col-actions,
.data-table th.col-actions,
.data-table td.col-actions {
  display: table-cell !important;
  vertical-align: middle !important;
  text-align: left !important;
  white-space: nowrap !important;
  width: 120px !important;
  min-width: 120px !important;
  max-width: none !important;
  overflow: visible !important;
}

.erp-table th.col-actions-wide,
.erp-table td.col-actions-wide,
.data-table th.col-actions-wide,
.data-table td.col-actions-wide {
  width: 300px !important;
  min-width: 260px !important;
}

.table-actions,
.col-actions > .table-actions,
.project-actions,
.task-row-actions,
.workbench-task-actions,
.material-actions,
.ui-image-actions,
.admin-user-actions,
.settings-provider-actions,
.row-actions,
.apk-actions,
.execution-actions,
.report-actions,
.ai-output-actions {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
  width: auto !important;
  min-width: 0 !important;
  height: 100% !important;
  white-space: nowrap !important;
  vertical-align: middle !important;
}

.table-actions .btn,
.table-actions button,
.table-actions a,
.table-actions form {
  flex: 0 0 auto !important;
}

.table-actions .btn,
.table-actions button,
.table-actions a.btn {
  height: 28px !important;
  min-height: 28px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.row-actions .row-save-state {
  flex: 0 0 auto !important;
  align-self: center !important;
}

/* 20260616 settings-product-ai-1: simplified AI configuration for ordinary testers. */
.settings-product-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 20px 22px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.settings-product-hero h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.settings-product-hero p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
}

.settings-hero-actions,
.settings-tabs,
.provider-card-actions,
.settings-key-row,
.settings-ai-toggle-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-tabs {
  margin: 0 0 14px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
}

.settings-tabs a {
  padding: 7px 12px;
  border-radius: 6px;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.settings-tabs a.active,
.settings-tabs a:hover {
  background: #eef4ff;
  color: #1d4ed8;
}

.settings-product-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: 14px;
  margin-bottom: 14px;
}

.settings-current-model-card,
.settings-ai-status-card,
.settings-product-section,
.settings-global-panel {
  border-radius: 8px;
}

.settings-model-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.settings-model-summary div,
.settings-test-result,
.settings-ai-user-note {
  display: grid;
  gap: 6px;
  min-height: 74px;
  padding: 12px 14px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fbff;
}

.settings-model-summary span,
.settings-test-result span,
.settings-ai-user-note span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.settings-model-summary strong,
.settings-test-result strong,
.settings-ai-user-note strong {
  color: #0f172a;
  font-size: 14px;
  line-height: 1.45;
}

.settings-inline-details {
  margin-top: 12px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
}

.settings-inline-details summary {
  cursor: pointer;
  padding: 10px 12px;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.settings-inline-details[open] summary {
  border-bottom: 1px solid #e5eaf2;
  background: #f8fbff;
}

.settings-role-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 12px;
}

.settings-role-form label,
.settings-simple-fields label,
.settings-provider-advanced label,
.settings-model-advanced label {
  display: grid;
  gap: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.settings-role-form em {
  color: #b45309;
  font-size: 12px;
  font-style: normal;
}

.settings-main-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #d6e4ff;
  border-radius: 999px;
  background: #f8fbff;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.settings-main-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.settings-main-switch span {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: #cbd5e1;
}

.settings-main-switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  transition: transform 160ms ease;
}

.settings-main-switch input:checked + span {
  background: #2563eb;
}

.settings-main-switch input:checked + span::after {
  transform: translateX(14px);
}

.settings-provider-cards {
  display: grid;
  gap: 10px;
}

.settings-provider-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.settings-provider-card:hover {
  border-color: #bcd2ff;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.08);
}

.provider-avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #eef4ff;
  color: #1d4ed8;
  font-size: 16px;
  font-weight: 900;
}

.provider-card-main {
  min-width: 0;
}

.provider-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.provider-card-title h3 {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
  font-weight: 900;
}

.provider-card-url {
  margin-top: 4px;
  color: #475569;
  font-family: Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.provider-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  color: #64748b;
  font-size: 12px;
}

.settings-empty-provider {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 22px;
  border: 1px dashed #bfd0e8;
  border-radius: 8px;
  background: #f8fbff;
}

.settings-quick-provider-form {
  width: 100%;
  align-items: stretch;
  justify-items: stretch;
  gap: 14px;
  border-style: solid;
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
}

.settings-quick-provider-heading {
  display: grid;
  gap: 4px;
}

.settings-quick-provider-heading strong {
  color: #0f172a;
  font-size: 16px;
  font-weight: 900;
}

.settings-quick-provider-heading span {
  color: #475569;
  font-size: 13px;
}

.settings-quick-provider-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.settings-quick-provider-grid label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.settings-quick-provider-grid input,
.settings-quick-provider-grid select {
  width: 100%;
  height: 34px;
  border: 1px solid #d4dfef;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
  font-weight: 650;
}

.settings-quick-provider-actions {
  justify-content: flex-start;
}

.settings-provider-drawer {
  width: min(900px, calc(100vw - var(--sidebar-width)));
}

.settings-simple-provider-form,
.settings-simple-model-form {
  background: #fff;
}

.settings-initial-model {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d6e4ff;
  border-radius: 8px;
  background: #f8fbff;
}

.settings-initial-model strong {
  color: #0f172a;
  font-size: 13px;
}

.settings-simple-fields {
  grid-template-columns: 1fr;
}

.settings-key-row {
  align-items: stretch;
}

.settings-key-row input {
  flex: 1 1 auto;
}

.settings-key-row .btn {
  flex: 0 0 auto;
}

.settings-provider-advanced,
.settings-model-advanced {
  grid-column: 1 / -1;
  background: #f8fbff;
}

.settings-provider-advanced .drawer-form-grid,
.settings-model-advanced .ai-checkbox-grid {
  padding: 12px;
}

.settings-model-advanced .settings-model-remark {
  padding: 0 12px 12px;
}

.settings-simple-toast {
  width: min(460px, 100%);
}

.settings-simple-toast p {
  margin: 0;
}

/* 20260617 ai-settings-draft-editor */
.settings-provider-drawer .detail-drawer-header {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid #e5e7eb;
}

.settings-provider-drawer .drawer-body {
  background: #f8fafc;
}

.settings-provider-drawer .drawer-edit-form,
.settings-provider-drawer .provider-model-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.settings-provider-drawer .provider-model-section {
  margin-top: 14px;
}

.settings-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.drawer-model-form {
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.drawer-model-form + .drawer-model-form {
  margin-top: 10px;
}

.drawer-model-form .actions,
.settings-provider-drawer .settings-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.settings-provider-drawer .settings-form-actions {
  position: sticky;
  bottom: -1px;
  z-index: 2;
  margin: 16px -16px -16px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid #e5e7eb;
}

.settings-provider-drawer .muted,
.settings-provider-drawer .drawer-model-meta {
  color: #64748b;
}

.settings-test-overlay {
  background: rgba(15, 23, 42, 0.26);
  backdrop-filter: blur(2px);
}

.settings-test-card {
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}

/* 20260617 product-information-architecture */
.product-page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  margin-bottom: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.product-page-hero h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.product-page-hero p {
  margin: 0;
  max-width: 720px;
  color: #64748b;
  font-size: 14px;
}

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

.workflow-summary-grid > div {
  min-height: 82px;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.workflow-summary-grid span {
  display: block;
  color: #64748b;
  font-size: 13px;
}

.workflow-summary-grid strong {
  display: block;
  margin-top: 8px;
  color: #0f172a;
  font-size: 26px;
  line-height: 1;
}

.task-workflow-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: -6px 0 16px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  overflow-x: auto;
}

.task-workflow-tabs a {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 6px;
  color: #334155;
  font-weight: 700;
  text-decoration: none;
}

.task-workflow-tabs a:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.advanced-only,
.nav-advanced-link {
  display: none !important;
}

.advanced-mode .advanced-only,
.advanced-mode .nav-advanced-link {
  display: revert !important;
}

.advanced-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.advanced-mode-toggle input {
  width: 16px;
  height: 16px;
}

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

.execution-center-table td,
.execution-center-table th,
.product-table td,
.product-table th {
  vertical-align: middle;
}

@media (max-width: 980px) {
  .product-page-hero {
    align-items: stretch;
    flex-direction: column;
  }
  .workflow-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Keep advanced/debug affordances hidden after legacy overrides. */
body:not(.advanced-mode) .advanced-only,
body:not(.advanced-mode) .nav-advanced-link {
  display: none !important;
}

/* 20260618 final-sky-saas-unification
   Last-mile visual layer for the confirmed light sky-blue SaaS direction.
   It intentionally changes presentation only: no API, auth, data, or workflow behavior. */
:root {
  --sky-page: #f6faff;
  --sky-page-2: #f8fbff;
  --sky-panel: #ffffff;
  --sky-soft: #f1f7ff;
  --sky-line: #e5eef8;
  --sky-line-strong: #d6e6f7;
  --sky-primary: #2f80ff;
  --sky-primary-strong: #1677ff;
  --sky-primary-soft: #eaf3ff;
  --sky-primary-softer: #f3f8ff;
  --sky-text: #102033;
  --sky-text-2: #314762;
  --sky-muted: #6b7f99;
  --sky-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  --sky-shadow-hover: 0 12px 30px rgba(47, 128, 255, 0.08);
  --sky-radius: 14px;
  --sky-radius-sm: 10px;
}

html,
body {
  background: var(--sky-page) !important;
  color: var(--sky-text);
}

body,
input,
select,
textarea,
button {
  letter-spacing: 0;
}

.app-shell,
.ruoyi-shell {
  background:
    radial-gradient(circle at top left, rgba(47, 128, 255, 0.08), transparent 28rem),
    linear-gradient(180deg, #ffffff 0%, var(--sky-page) 20rem, var(--sky-page-2) 100%) !important;
}

.sidebar {
  width: 216px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  border-right: 1px solid var(--sky-line) !important;
  box-shadow: 10px 0 30px rgba(15, 23, 42, 0.035) !important;
  backdrop-filter: blur(10px);
}

.brand-row {
  min-height: 76px;
  padding: 18px 16px 14px !important;
  border-bottom: 0 !important;
}

.brand {
  gap: 10px;
}

.brand-mark {
  width: 34px !important;
  height: 34px !important;
  border-radius: 12px !important;
  background: linear-gradient(145deg, #60a5fa 0%, var(--sky-primary) 100%) !important;
  color: #fff !important;
  box-shadow: 0 10px 22px rgba(47, 128, 255, 0.18) !important;
}

.brand-text {
  color: var(--sky-text) !important;
  font-weight: 900 !important;
  line-height: 1.25 !important;
}

.sidebar-toggle,
.topbar-menu-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 34px !important;
  height: 34px !important;
  border: 1px solid var(--sky-line) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: var(--sky-text-2) !important;
  box-shadow: none !important;
}

.sidebar-toggle:hover,
.topbar-menu-button:hover {
  border-color: #bfdbfe !important;
  background: var(--sky-primary-softer) !important;
  color: var(--sky-primary-strong) !important;
}

.nav {
  padding: 8px 12px 18px !important;
}

.nav-group-label {
  margin: 18px 10px 8px !important;
  color: #8aa0ba !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
}

.nav a,
.nav-disabled-link {
  min-height: 42px !important;
  margin: 4px 0 !important;
  padding: 0 12px !important;
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  background: transparent !important;
  color: var(--sky-text-2) !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  box-shadow: none !important;
}

.nav a:hover {
  background: var(--sky-primary-softer) !important;
  color: var(--sky-primary-strong) !important;
}

.nav a.active {
  border-color: #dbeafe !important;
  background: var(--sky-primary-soft) !important;
  color: var(--sky-primary-strong) !important;
}

.nav-icon {
  width: 28px !important;
  min-width: 28px !important;
  height: 28px !important;
  border-radius: 9px !important;
  background: #f0f7ff !important;
  color: #41668c !important;
  font-size: 11px !important;
  font-weight: 900 !important;
}

.nav a.active .nav-icon {
  background: var(--sky-primary) !important;
  color: #fff !important;
}

body.sidebar-collapsed .sidebar {
  width: 64px !important;
}

body.sidebar-collapsed .brand-row {
  padding: 16px 10px !important;
  justify-content: center !important;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .sidebar-toggle,
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .nav-text {
  display: none !important;
}

body.sidebar-collapsed .nav {
  padding: 8px 8px !important;
}

body.sidebar-collapsed .nav a,
body.sidebar-collapsed .nav-disabled-link {
  width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  margin: 6px auto !important;
  padding: 0 !important;
  justify-content: center !important;
}

body.sidebar-collapsed .nav-icon {
  display: inline-flex !important;
  width: 28px !important;
  min-width: 28px !important;
  height: 28px !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.main {
  background: transparent !important;
}

.ruoyi-topbar,
.topbar {
  min-height: 64px !important;
  padding: 12px 24px !important;
  border-bottom: 0 !important;
  background: rgba(246, 250, 255, 0.88) !important;
  box-shadow: none !important;
  backdrop-filter: blur(12px);
}

.topbar-breadcrumb,
.ruoyi-tags-view {
  display: none !important;
}

.topbar-title-stack h1 {
  margin: 0 !important;
  color: var(--sky-text) !important;
  font-size: 18px !important;
  font-weight: 900 !important;
}

.topbar-right {
  gap: 12px !important;
}

.advanced-mode-toggle,
.user-chip {
  min-height: 34px;
  padding: 0 12px !important;
  border: 1px solid var(--sky-line) !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.86) !important;
  color: var(--sky-text-2) !important;
}

.user-chip {
  font-weight: 850 !important;
}

.content {
  padding: 18px 24px 32px !important;
}

.panel,
.erp-page-panel,
.product-page-hero,
.task-detail-hero,
.task-context-bar,
.settings-product-hero,
.admin-page-head,
.admin-register-panel,
.admin-user-panel,
.admin-log-panel,
.task-progress-panel,
.task-run-panel,
.task-stage-panel,
.task-count-panel,
.settings-current-model-card,
.settings-ai-status-card,
.settings-provider-panel,
.settings-global-panel,
.workflow-summary-grid > div,
.admin-metric,
.metric,
.settings-provider-card,
.drawer-model-form,
.settings-provider-drawer .drawer-edit-form,
.settings-provider-drawer .provider-model-section {
  border: 1px solid var(--sky-line) !important;
  border-radius: var(--sky-radius) !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: var(--sky-shadow) !important;
}

.panel,
.erp-page-panel {
  padding: 18px !important;
}

.panel:hover,
.settings-provider-card:hover,
.workflow-summary-grid > div:hover {
  box-shadow: var(--sky-shadow-hover) !important;
}

.product-page-hero,
.task-detail-hero,
.task-context-bar,
.settings-product-hero,
.admin-page-head {
  padding: 20px 22px !important;
  margin-bottom: 16px !important;
}

.product-page-hero h2,
.task-detail-hero h2,
.task-context-main h2,
.settings-product-hero h2,
.admin-page-head h2,
.panel h2,
.panel-title-row h2 {
  color: var(--sky-text) !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
}

.muted,
.cell-muted,
.breadcrumb,
.panel p,
.product-page-hero p,
.settings-product-hero p,
.admin-page-subtitle {
  color: var(--sky-muted) !important;
}

.workflow-summary-grid {
  gap: 14px !important;
}

.workflow-summary-grid > div,
.admin-metric,
.metric {
  min-height: 86px;
  position: relative;
  overflow: hidden;
}

.workflow-summary-grid > div::after,
.admin-metric::after,
.metric::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 14px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--sky-primary-soft);
  opacity: 0.9;
}

.workflow-summary-grid span,
.admin-metric span,
.metric label,
.metric span {
  color: var(--sky-muted) !important;
  font-weight: 750 !important;
}

.workflow-summary-grid strong,
.admin-metric strong,
.metric strong {
  color: #091427 !important;
  font-weight: 950 !important;
}

.btn,
button.btn,
a.btn {
  min-height: 34px !important;
  padding: 0 14px !important;
  border: 1px solid var(--sky-line-strong) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: var(--sky-primary-strong) !important;
  font-weight: 850 !important;
  box-shadow: none !important;
}

.btn:hover:not(:disabled),
button.btn:hover:not(:disabled),
a.btn:hover {
  border-color: #b8d8ff !important;
  background: var(--sky-primary-softer) !important;
  color: #0f66e8 !important;
}

.btn.primary,
button.btn.primary,
a.btn.primary {
  border-color: var(--sky-primary) !important;
  background: linear-gradient(180deg, #3b8cff 0%, var(--sky-primary-strong) 100%) !important;
  color: #fff !important;
  box-shadow: 0 10px 22px rgba(47, 128, 255, 0.18) !important;
}

.btn.primary:hover:not(:disabled),
button.btn.primary:hover:not(:disabled),
a.btn.primary:hover {
  border-color: #0f66e8 !important;
  background: #0f66e8 !important;
  color: #fff !important;
}

.btn.danger,
button.btn.danger,
a.btn.danger {
  border-color: #fecaca !important;
  background: #fff5f5 !important;
  color: #dc2626 !important;
  box-shadow: none !important;
}

.btn.danger:hover:not(:disabled),
button.btn.danger:hover:not(:disabled),
a.btn.danger:hover {
  border-color: #fca5a5 !important;
  background: #fee2e2 !important;
}

.btn.small,
.btn.sm,
button.btn.small,
button.btn.sm,
a.btn.small,
a.btn.sm,
.table-actions .btn,
.table-actions button,
.table-actions a {
  min-height: 28px !important;
  height: 28px !important;
  padding: 0 10px !important;
  border-radius: 8px !important;
  font-size: 12px !important;
}

.actions,
.table-actions,
.panel-actions,
.task-row-actions,
.project-actions,
.material-actions,
.ui-image-actions,
.execution-actions,
.report-actions,
.ai-output-actions {
  gap: 8px !important;
}

.table-wrap {
  border: 1px solid var(--sky-line) !important;
  border-radius: var(--sky-radius) !important;
  background: #fff !important;
  box-shadow: none !important;
  overflow: auto;
}

table.erp-table,
table.data-table,
.erp-table,
.data-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: #fff !important;
}

.erp-table th,
.erp-table td,
.data-table th,
.data-table td {
  height: 48px !important;
  padding: 10px 14px !important;
  border-bottom: 1px solid var(--sky-line) !important;
  vertical-align: middle !important;
}

.erp-table th,
.data-table th {
  background: #f1f7ff !important;
  color: #425773 !important;
  font-size: 12px !important;
  font-weight: 900 !important;
}

.erp-table tbody tr:hover,
.data-table tbody tr:hover {
  background: #f8fbff !important;
}

.erp-table td,
.data-table td {
  color: var(--sky-text-2) !important;
}

.erp-table td strong,
.data-table td strong {
  color: var(--sky-text) !important;
}

.col-actions,
td.col-actions,
th.col-actions {
  width: 132px !important;
  min-width: 132px !important;
  text-align: left !important;
  white-space: nowrap !important;
}

.col-actions-wide,
td.col-actions-wide,
th.col-actions-wide {
  width: 220px !important;
  min-width: 220px !important;
}

.table-actions {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  flex-wrap: nowrap !important;
  height: 100% !important;
  white-space: nowrap !important;
}

.status,
.status-pill,
.status-badge,
.badge,
[class*="status-"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #eef5ff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

.status.success,
.status-pill.success,
.status-badge.success,
.status-DONE,
.status-SUCCESS,
.status-READY,
.status-ACTIVE,
.status-COMPLETED,
.status-COMPLETED_WITH_REVIEW {
  border-color: #bbf7d0 !important;
  background: #ecfdf5 !important;
  color: #059669 !important;
}

.status.danger,
.status-pill.danger,
.status-FAILED,
.status-ERROR,
.status-BLOCKED,
.status-DISABLED {
  border-color: #fecaca !important;
  background: #fff1f2 !important;
  color: #e11d48 !important;
}

.status-warning,
.status-REVIEW,
.status-NEED_REVIEW,
.status-PENDING,
.status-untested {
  border-color: #fed7aa !important;
  background: #fff7ed !important;
  color: #ea580c !important;
}

.status-muted,
.status-badge.muted,
.status-pill.muted {
  border-color: #e2e8f0 !important;
  background: #f8fafc !important;
  color: #64748b !important;
}

.erp-filter-bar,
.query-form,
.case-sticky-toolbar,
.erp-bulk-toolbar {
  border: 1px solid var(--sky-line) !important;
  border-radius: var(--sky-radius) !important;
  background: rgba(255, 255, 255, 0.92) !important;
  box-shadow: var(--sky-shadow) !important;
}

input,
select,
textarea,
.compact-input {
  border: 1px solid #d9e7f7 !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: var(--sky-text) !important;
  box-shadow: none !important;
}

input:focus,
select:focus,
textarea:focus,
.compact-input:focus {
  border-color: #93c5fd !important;
  box-shadow: 0 0 0 3px rgba(47, 128, 255, 0.12) !important;
  outline: none !important;
}

.notice {
  border: 1px solid var(--sky-line) !important;
  border-radius: var(--sky-radius-sm) !important;
  background: #f8fbff !important;
  color: var(--sky-text-2) !important;
}

.notice.info {
  border-color: #cfe4ff !important;
  background: #f1f7ff !important;
  color: #245f9f !important;
}

.notice.warning {
  border-color: #fed7aa !important;
  background: #fff7ed !important;
  color: #9a3412 !important;
}

.notice.error,
.notice.danger {
  border-color: #fecaca !important;
  background: #fff1f2 !important;
  color: #be123c !important;
}

.detail-drawer {
  width: min(860px, calc(100vw - 72px)) !important;
  border-left: 1px solid var(--sky-line) !important;
  background: #fff !important;
  box-shadow: -18px 0 42px rgba(15, 23, 42, 0.08) !important;
}

.detail-drawer-header,
.drawer-footer {
  border-color: var(--sky-line) !important;
  background: rgba(248, 251, 255, 0.96) !important;
}

.drawer-body {
  background: #f8fbff !important;
}

.drawer-tabs {
  background: #fff !important;
  border-color: var(--sky-line) !important;
}

.drawer-tab {
  border-radius: 10px 10px 0 0 !important;
  color: var(--sky-muted) !important;
}

.drawer-tab.active {
  background: var(--sky-primary-soft) !important;
  color: var(--sky-primary-strong) !important;
  border-bottom-color: var(--sky-primary) !important;
}

.modal-backdrop,
.app-dialog-backdrop {
  background: rgba(16, 32, 51, 0.28) !important;
  backdrop-filter: blur(3px);
}

.modal-panel,
.modal-card,
.modal-content,
.app-dialog-panel,
.settings-test-card {
  border: 1px solid var(--sky-line) !important;
  border-radius: 16px !important;
  background: #fff !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14) !important;
}

.modal-close-btn,
.drawer-close,
.close-btn {
  border: 1px solid var(--sky-line) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: #64748b !important;
}

.modal-close-btn:hover,
.drawer-close:hover,
.close-btn:hover {
  border-color: #bfdbfe !important;
  background: var(--sky-primary-softer) !important;
  color: var(--sky-primary-strong) !important;
}

.more-menu,
.action-more,
.row-more,
.run-summary-more {
  position: relative;
}

.more-menu > summary,
.action-more > summary,
.row-more > summary,
.run-summary-more > summary {
  list-style: none !important;
  cursor: pointer !important;
}

.more-menu > summary::-webkit-details-marker,
.action-more > summary::-webkit-details-marker,
.row-more > summary::-webkit-details-marker,
.run-summary-more > summary::-webkit-details-marker {
  display: none !important;
}

.more-menu-panel,
.action-more-menu,
.row-more-menu,
.run-summary-reasons {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 174px;
  padding: 6px;
  border: 1px solid var(--sky-line) !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12) !important;
}

.more-menu-panel a,
.more-menu-panel button,
.action-more-menu a,
.action-more-menu button,
.row-more-menu a,
.row-more-menu button {
  width: 100%;
  justify-content: flex-start;
  min-height: 32px !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--sky-text-2) !important;
  box-shadow: none !important;
}

.more-menu-panel a:hover,
.more-menu-panel button:hover,
.action-more-menu a:hover,
.action-more-menu button:hover,
.row-more-menu a:hover,
.row-more-menu button:hover {
  background: var(--sky-primary-softer) !important;
  color: var(--sky-primary-strong) !important;
}

.empty-state {
  border: 1px dashed #cfe4ff !important;
  border-radius: var(--sky-radius) !important;
  background: #f8fbff !important;
  color: var(--sky-muted) !important;
}

.task-workflow-tabs {
  position: relative;
  gap: 0 !important;
  padding: 10px !important;
  border: 1px solid var(--sky-line) !important;
  border-radius: 16px !important;
  background: #fff !important;
  box-shadow: var(--sky-shadow) !important;
}

.task-workflow-tabs a {
  position: relative;
  min-width: 120px;
  padding: 10px 16px !important;
  color: var(--sky-muted) !important;
  text-align: center;
}

.task-workflow-tabs a::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 1px solid #bfd7f4;
  border-right: 1px solid #bfd7f4;
  transform: translateY(-50%) rotate(45deg);
}

.task-workflow-tabs a:last-child::after {
  display: none;
}

.task-workflow-tabs a:hover {
  background: var(--sky-primary-soft) !important;
  color: var(--sky-primary-strong) !important;
}

.task-step-card,
.task-drawer-link-grid .btn,
.quick-entry-card,
.material-type-card,
.ui-image-card {
  border: 1px solid var(--sky-line) !important;
  border-radius: 14px !important;
  background: #fff !important;
  box-shadow: var(--sky-shadow) !important;
}

.task-step-card.done {
  border-color: #bbf7d0 !important;
  background: #f0fdf4 !important;
}

.task-step-card.active {
  border-color: #bfdbfe !important;
  background: #eff6ff !important;
}

.task-step-card.todo {
  background: #fff !important;
}

.ai-generation-evidence-grid,
.evidence-list,
.inline-json,
pre {
  border-radius: 12px !important;
}

body:not(.advanced-mode) .ai-generation-evidence-grid .advanced-only,
body:not(.advanced-mode) .evidence-list.advanced-only,
body:not(.advanced-mode) .ai-generation-log-line pre,
body:not(.advanced-mode) .inline-json.advanced-only {
  display: none !important;
}

.global-loading-card {
  border: 1px solid var(--sky-line) !important;
  border-radius: 16px !important;
  background: #fff !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14) !important;
}

.global-loading-spinner {
  border-color: #dbeafe !important;
  border-top-color: var(--sky-primary) !important;
}

@media (max-width: 980px) {
  .content {
    padding: 14px !important;
  }

  .sidebar {
    width: 64px !important;
  }

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

  .detail-drawer {
    width: calc(100vw - 12px) !important;
  }
}

/* Keep advanced/debug affordances hidden after the final visual layer. */
body:not(.advanced-mode) .advanced-only,
body:not(.advanced-mode) .nav-advanced-link {
  display: none !important;
}

@media (max-width: 980px) {
  .settings-product-grid,
  .settings-model-summary,
  .settings-role-form {
    grid-template-columns: 1fr;
  }

  .settings-provider-card {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .provider-card-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .settings-quick-provider-grid {
    grid-template-columns: 1fr;
  }
}

/* Final scoped layer: visual case generation prompt contract preview. */
.ai-generation-prompt-template details {
  margin-top: 10px;
}

.ai-generation-prompt-template summary {
  cursor: pointer;
  font-weight: 700;
}

.ai-generation-prompt-template .prompt-readonly-textarea {
  width: 100%;
  min-height: 360px;
  margin-top: 12px;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}

/* Final product IA override: advanced/debug affordances are opt-in. */
body:not(.advanced-mode) .advanced-only,
body:not(.advanced-mode) .nav-advanced-link {
  display: none !important;
}
