:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #18202f;
  --muted: #667085;
  --line: #d9e0ea;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b42318;
  --soft: #eef6f5;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: minmax(0, 1fr);
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  transition: grid-template-columns 0.18s ease;
}

body.sidebar-collapsed {
  grid-template-columns: 72px 1fr;
}

body.sidebar-hidden {
  grid-template-columns: 1fr;
}

.sidebar {
  background: #101828;
  color: #fff;
  padding: 22px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  transition: opacity 0.18s ease, transform 0.18s ease, padding 0.18s ease;
  display: flex;
  flex-direction: column;
}

body.sidebar-hidden .sidebar {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-100%);
  padding-left: 0;
  padding-right: 0;
}

body.sidebar-collapsed .sidebar {
  padding: 18px 12px;
}

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

body.sidebar-collapsed .brand {
  justify-content: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--primary);
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.brand p {
  margin: 4px 0 0;
  color: #b8c2d3;
  font-size: 13px;
}

.sidebar-toggle {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: #1d2939;
  color: #d0d5dd;
  cursor: pointer;
  font-size: 16px;
}

.sidebar-toggle:hover {
  color: #fff;
  background: #263548;
}

.sidebar-restore {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 20;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: #101828;
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-size: 16px;
  animation: sidebarRestoreIn 0.18s ease;
}

.sidebar-restore:hover {
  background: #1d2939;
}

@keyframes sidebarRestoreIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .menu-parent span:nth-child(2),
body.sidebar-collapsed .menu-arrow,
body.sidebar-collapsed .submenu {
  display: none;
}

body.sidebar-collapsed .brand-mark {
  display: none;
}

body.sidebar-collapsed .sidebar-toggle {
  margin-left: 0;
}

.side-menu {
  display: grid;
  gap: 6px;
}

.logout-btn {
  margin-top: auto;
  border: 1px solid #344054;
  background: transparent;
  color: #d0d5dd;
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  text-align: left;
}

.logout-btn:hover {
  background: #1d2939;
  color: #fff;
}

.permission-panel {
  max-width: 860px;
}

.permission-user-field {
  max-width: 360px;
}

.permission-multi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.permission-multi-grid small {
  color: var(--muted);
  font-size: 13px;
}

.permission-multi-select {
  min-height: 260px;
  padding: 6px;
}

.permission-actions {
  margin-top: 16px;
}

.menu-section {
  display: grid;
  gap: 4px;
}

.menu-parent {
  width: 100%;
  border: 0;
  background: transparent;
  color: #d0d5dd;
  text-align: left;
  padding: 11px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  display: grid;
  grid-template-columns: 24px 1fr 16px;
  align-items: center;
  gap: 8px;
}

.menu-parent.active,
.menu-parent:hover {
  background: #1d2939;
  color: #fff;
}

body.sidebar-collapsed .menu-parent {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 10px;
}

.menu-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #263548;
  color: #d0d5dd;
  font-size: 12px;
  font-weight: 700;
}

.menu-parent.active .menu-icon {
  background: var(--primary);
  color: #fff;
}

.menu-arrow {
  color: #98a2b3;
  transition: transform 0.15s ease;
}

.menu-section.collapsed .menu-arrow {
  transform: rotate(-90deg);
}

.submenu {
  display: grid;
  gap: 2px;
  padding-left: 32px;
}

.menu-section.collapsed .submenu {
  display: none;
}

.nav-label {
  padding: 0 12px;
  color: #98a2b3;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.nav-btn {
  border: 0;
  background: transparent;
  color: #d0d5dd;
  text-align: left;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.nav-btn.active,
.nav-btn:hover {
  background: #1d2939;
  color: #fff;
}

.main {
  padding: 24px;
  overflow: auto;
}

@media (min-width: 981px) {
  body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-head h2 {
  margin: 0;
  font-size: 24px;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.workbench,
.history-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(520px, 1.15fr);
  gap: 18px;
}

.review-selectors {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel h3 {
  margin: 0;
  font-size: 17px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.segment {
  border: 0;
  background: #fff;
  padding: 8px 14px;
  cursor: pointer;
}

.segment.active {
  background: var(--soft);
  color: var(--primary-dark);
  font-weight: 600;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed #98a2b3;
  border-radius: 8px;
  background: #fbfcfe;
  cursor: pointer;
  margin-bottom: 16px;
}

.dropzone input {
  display: none;
}

.drop-title {
  font-size: 18px;
  font-weight: 650;
}

.drop-sub {
  margin-top: 4px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field span {
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.field.inline {
  grid-template-columns: 80px 1fr;
  align-items: center;
  margin: 0;
}

.field.compact {
  width: 130px;
  margin: 0;
}

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

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.textarea.large {
  min-height: 260px;
  margin-bottom: 16px;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
}

.primary-btn:disabled,
.ghost-btn:disabled,
.danger-btn:disabled {
  cursor: wait;
  opacity: 0.68;
}

.is-loading {
  position: relative;
}

.is-loading::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.ghost-btn {
  background: #fff;
  border: 1px solid var(--line);
  color: #344054;
}

.danger-btn {
  background: #fff4f2;
  color: var(--danger);
}

.status {
  margin-top: 12px;
  color: var(--muted);
  min-height: 20px;
}

.status.error {
  color: var(--danger);
}

.status.ok {
  color: var(--primary-dark);
}

.routing-toggle {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 13px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.routing-toggle.active {
  border-color: #5bb5aa;
  background: var(--soft);
  color: var(--primary-dark);
  font-weight: 600;
}

.reimbursement-result-panel {
  min-height: 430px;
}

.reimbursement-workbench {
  grid-template-columns: minmax(340px, 0.72fr) minmax(0, 1.28fr);
  align-items: start;
}

.reimbursement-left-column {
  display: grid;
  min-width: 0;
  gap: 18px;
}

@media (min-width: 981px) {
  .reimbursement-result-panel {
    position: sticky;
    top: 0;
    max-height: calc(100vh - 126px);
    overflow: auto;
  }
}

.reimbursement-result-empty {
  min-height: 330px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

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

.reimbursement-system-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.reimbursement-system-summary span {
  color: var(--muted);
  font-size: 12px;
}

.reimbursement-system-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 13px;
}

.reimbursement-edit-field {
  min-width: 0;
}

.reimbursement-edit-field > span,
.reimbursement-edit-field > small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.reimbursement-edit-field .input {
  margin-top: 6px;
}

.reimbursement-edit-field > small {
  margin-top: 4px;
}

.reimbursement-edit-field .input:disabled,
.reimbursement-edit-table .input:disabled {
  background: #f7f8fa;
  color: #475467;
  opacity: 1;
}

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

.reimbursement-field span,
.reimbursement-field small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.reimbursement-field strong {
  display: block;
  margin: 6px 0;
  word-break: break-word;
}

.approval-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.approval-badge.neutral {
  background: #f2f4f7;
  color: var(--muted);
}

.approval-badge.approved {
  background: #ecfdf3;
  color: #027a48;
}

.approval-badge.review {
  background: #fffaeb;
  color: #b54708;
}

.approval-badge.reviewed {
  background: #eef4ff;
  color: #3538cd;
}

.reimbursement-review-reasons {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #fedf89;
  border-radius: 8px;
  background: #fffaeb;
  color: #7a2e0e;
}

.reimbursement-review-reasons ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.reimbursement-detail-section {
  margin-top: 18px;
}

.reimbursement-detail-section h4 {
  margin: 0 0 10px;
}

.reimbursement-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.reimbursement-detail-head h4 {
  margin: 0;
}

.reimbursement-detail-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.reimbursement-detail-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 13px;
}

.reimbursement-edit-table {
  min-width: 1480px;
}

.reimbursement-edit-table th:last-child,
.reimbursement-edit-table td:last-child {
  width: 42px;
  padding-right: 8px;
  padding-left: 8px;
}

.reimbursement-edit-table .input {
  min-width: 112px;
  padding: 7px 8px;
}

.reimbursement-edit-table td:first-child .input,
.reimbursement-edit-table td:nth-last-child(2) .input {
  min-width: 150px;
}

.danger-icon-btn {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.danger-icon-btn:disabled {
  visibility: hidden;
}

.reimbursement-review-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.reimbursement-review-actions > span {
  color: var(--muted);
  font-size: 12px;
}

.reimbursement-review-actions > div {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.reimbursement-detail-table th,
.reimbursement-detail-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.reimbursement-detail-table th {
  background: #f7f8fa;
  color: var(--muted);
  font-weight: 600;
}

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

.reimbursement-detail-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.reimbursement-history-panel {
  margin-top: 0;
}

.reimbursement-history {
  max-height: 360px;
}

.reimbursement-batch {
  border-bottom: 1px solid var(--line);
}

.reimbursement-batch > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px;
  cursor: pointer;
  list-style: none;
}

.reimbursement-batch > summary::-webkit-details-marker {
  display: none;
}

.reimbursement-batch-summary {
  min-width: 0;
}

.reimbursement-batch-summary span,
.reimbursement-batch-summary small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.batch-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e7ec;
}

.batch-progress span {
  display: block;
  height: 100%;
  min-width: 0;
  background: var(--primary);
  transition: width 180ms ease;
}

.reimbursement-batch-actions {
  display: flex;
  gap: 8px;
  padding: 10px 0;
}

.reimbursement-batch-documents {
  padding: 0 0 12px 18px;
  border-left: 2px solid var(--line);
}

.reimbursement-ignored {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.reimbursement-ignored summary {
  cursor: pointer;
}

.reimbursement-ignored ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.reimbursement-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
}

.reimbursement-document-entry + .reimbursement-document-entry {
  margin-top: 8px;
}

.reimbursement-ticket-preview {
  margin: 8px 0 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8fa;
}

.reimbursement-ticket-preview iframe {
  display: block;
  width: 100%;
  height: min(60vh, 640px);
  border: 0;
  background: #fff;
}

.reimbursement-ticket-preview img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.reimbursement-preview-message {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.reimbursement-history-item:hover,
.reimbursement-history-item:focus-visible,
.reimbursement-history-item.selected {
  border-color: #5bb5aa;
  background: var(--soft);
  outline: none;
}

.reimbursement-history-main {
  min-width: 0;
}

.reimbursement-history-side,
.reimbursement-history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reimbursement-history-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.reimbursement-history-side {
  flex-shrink: 0;
}

.reimbursement-history-item span,
.reimbursement-history-item small {
  display: block;
  color: var(--muted);
}

.progress {
  width: 100%;
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e7ec;
}

.progress-bar {
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  animation: progress-slide 1.15s ease-in-out infinite;
}

.report {
  margin: 0;
  min-height: 540px;
  max-height: calc(100vh - 170px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Microsoft YaHei UI", monospace;
  font-size: 13px;
  line-height: 1.55;
  background: #0b1220;
  color: #edf2f7;
  border-radius: 6px;
  padding: 16px;
}

.report.markdown-body {
  white-space: normal;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.7;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 1.2em 0 0.55em;
  line-height: 1.3;
  color: #fff;
}

.markdown-body h1 {
  padding-bottom: 0.35em;
  border-bottom: 1px solid #344054;
  font-size: 1.75em;
}

.markdown-body h2 {
  padding-bottom: 0.25em;
  border-bottom: 1px solid #344054;
  font-size: 1.4em;
}

.markdown-body h3 {
  font-size: 1.18em;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body pre,
.markdown-body table {
  margin: 0 0 1em;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.8em;
}

.markdown-body li + li {
  margin-top: 0.25em;
}

.markdown-body .task-item {
  list-style: none;
}

.markdown-body .task-item > span {
  display: inline-block;
  width: 1.5em;
  margin-left: -1.5em;
}

.markdown-body blockquote {
  padding: 0.6em 1em;
  border-left: 4px solid var(--primary);
  background: #162235;
  color: #d0d5dd;
}

.markdown-body code {
  padding: 0.12em 0.35em;
  border-radius: 4px;
  background: #1d2939;
  font-family: Consolas, monospace;
}

.markdown-body pre {
  overflow: auto;
  padding: 12px;
  border: 1px solid #344054;
  border-radius: 6px;
  background: #101828;
  white-space: pre;
}

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

.markdown-body a {
  color: #84caff;
}

.markdown-body hr {
  margin: 1.4em 0;
  border: 0;
  border-top: 1px solid #344054;
}

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

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
}

.markdown-body th,
.markdown-body td {
  padding: 8px 10px;
  border: 1px solid #344054;
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: #1d2939;
  color: #fff;
}

.model-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.models-list {
  display: grid;
  gap: 14px;
}

.review-profile-config-panel {
  margin-top: 18px;
}

.external-api-config-panel {
  margin-top: 0;
}

.external-api-grid {
  display: grid;
  gap: 14px;
}

.external-api-value-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
}

.external-api-token {
  font-family: Consolas, monospace;
}

.external-api-token-meta {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
}

.status-chip {
  color: var(--muted);
  font-size: 13px;
}

.review-profile-config-list {
  display: grid;
  gap: 14px;
}

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

.review-profile-card-head {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.review-profile-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(200px, 1fr) 130px 150px;
  align-items: end;
  gap: 12px;
}

.review-profile-grid .field.compact {
  width: auto;
}

.review-profile-card .remove-review-profile {
  margin-top: 12px;
}

.model-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.model-card-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-bottom: 12px;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.wide {
  grid-column: 1 / -1;
}

.switch {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: #344054;
  font-size: 14px;
}

.model-vision-row {
  min-height: 42px;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.compact-actions {
  margin-top: 0;
  flex-shrink: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.metric-card strong {
  font-size: 26px;
}

.table-list {
  display: grid;
  gap: 10px;
  max-height: 460px;
  overflow: auto;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: start;
}

.state-pill {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  color: #344054;
  font-size: 12px;
  font-weight: 500;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.asset-card,
.history-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.asset-card strong,
.history-item strong {
  display: block;
  margin-bottom: 6px;
}

.asset-ok {
  color: var(--primary-dark);
}

.asset-missing {
  color: var(--danger);
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 160px);
  overflow: auto;
}

.monitoring-status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.monitoring-status-strip > div {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.monitoring-status-strip > div:last-child {
  border-right: 0;
}

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

.monitoring-health::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}

.monitoring-health.up::before {
  background: #258750;
}

.monitoring-health.down::before {
  background: #c23b3b;
}

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

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

.monitoring-metrics > div {
  min-width: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.monitoring-metrics > div:nth-child(odd) {
  padding-right: 18px;
}

.monitoring-metrics > div:nth-child(even) {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.monitoring-metrics > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.monitoring-metrics dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.monitoring-metrics dd {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

.monitoring-table {
  width: 100%;
  border-collapse: collapse;
}

.monitoring-table th,
.monitoring-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.monitoring-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

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

.monitoring-task-status {
  font-weight: 700;
}

.monitoring-task-status.status-failed,
.monitoring-task-status.status-partial,
.monitoring-task-status.status-completed_with_errors {
  color: #b52f2f;
}

.monitoring-task-status.status-completed {
  color: #25774a;
}

.monitoring-user-panel {
  margin-top: 16px;
}

.monitoring-user-panel .panel-head > div {
  min-width: 0;
}

.monitoring-user-panel .select {
  width: 160px;
  flex: 0 0 160px;
}

.monitoring-user-summary {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.monitoring-user-table {
  min-width: 760px;
}

.monitoring-user-state {
  font-weight: 700;
}

.monitoring-user-state.active {
  color: #25774a;
}

.monitoring-user-state.inactive {
  color: var(--muted);
}

.history-item-detail {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-audit-snapshot {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.report-audit-snapshot h4 {
  margin: 0 0 12px;
  font-size: 15px;
}

.report-audit-snapshot dl {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 92px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.report-audit-snapshot dt {
  color: var(--muted);
}

.report-audit-snapshot dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

#view-history > .history-layout {
  grid-template-columns: minmax(340px, 0.72fr) minmax(520px, 1.28fr);
  align-items: start;
}

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

#view-history .history-source-grid {
  grid-template-columns: minmax(0, 1fr);
}

#view-history .history-source-box > .history-section > .history-list {
  max-height: none;
  overflow: visible;
}

#view-history .history-file-list {
  --history-file-row-height: 104px;
  grid-auto-rows: var(--history-file-row-height);
  max-height: 560px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

#view-history .history-file-list > .history-item {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.history-preview-panel {
  position: sticky;
  top: 18px;
  min-width: 0;
  min-height: calc(100vh - 128px);
}

.history-preview-panel > h3 {
  margin-top: 0;
}

#history-output {
  max-height: calc(100vh - 196px);
  overflow: auto;
}

.history-preview-empty {
  margin: 0;
  color: var(--muted);
}

.history-original-pages {
  display: grid;
  gap: 18px;
  padding: 18px;
  background: #d7dce3;
}

.history-original-page {
  display: block;
  width: 100%;
  max-width: 1100px;
  height: auto;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.18);
}

.history-original-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.history-source-box {
  min-width: 0;
}

.history-source-box > h3,
.history-source-head h3 {
  margin-top: 0;
}

.history-source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rpa-log {
  min-height: 360px;
  max-height: 520px;
  margin-top: 12px;
}

.rpa-queue {
  min-height: 100px;
  max-height: 240px;
  margin-top: 12px;
}

.rpa-log-select {
  width: auto;
  min-width: 230px;
}

.history-section + .history-section {
  margin-top: 16px;
}

.history-section summary {
  cursor: pointer;
  font-size: 17px;
  font-weight: 600;
}

.history-section[open] summary {
  margin-bottom: 12px;
}

.history-item {
  cursor: pointer;
}

.history-item:hover {
  border-color: var(--primary);
}

.history-item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

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

.history-group {
  display: grid;
  gap: 10px;
}

.history-group-title {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-align: left;
}

.history-group-toggle {
  display: inline-block;
  transition: transform 0.15s ease;
}

.history-group.collapsed .history-group-toggle {
  transform: rotate(-90deg);
}

.history-group-body {
  display: grid;
  gap: 10px;
}

.history-status-group > .history-group-title {
  background: var(--soft);
  font-weight: 700;
}

.history-status-group > .history-group-body {
  padding-left: 12px;
}

.history-group.collapsed .history-group-body {
  display: none;
}

.small-btn {
  padding: 7px 10px;
  white-space: nowrap;
}

.asset-editor-layout {
  margin-top: 18px;
  grid-template-columns: minmax(240px, 0.3fr) minmax(0, 0.7fr);
  align-items: start;
}

.asset-editor-layout #asset-file-list {
  max-height: calc(100vh - 300px);
}

.asset-editor-layout #asset-content {
  height: clamp(320px, calc(100vh - 380px), 560px);
  min-height: 180px;
  max-height: 75vh;
  resize: vertical;
}

.asset-editor-layout .asset-preview {
  margin-top: 12px;
  min-height: 220px;
  max-height: min(360px, calc(100vh - 420px));
}

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

.asset-toolbar .select {
  width: auto;
  min-width: 160px;
}

.asset-status-folder,
.asset-skill-folder {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.asset-status-folder {
  margin-bottom: 18px;
}

.asset-repository-config {
  padding: 14px;
}

.asset-repository-config .actions {
  margin-top: 14px;
}

.asset-status-folder > summary,
.asset-skill-folder > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 700;
}

.asset-status-folder[open] > summary,
.asset-skill-folder[open] > summary {
  border-bottom: 1px solid var(--line);
}

.asset-status-folder .asset-grid,
.asset-skill-folder .history-list {
  padding: 14px;
}

.asset-skill-folder > summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.wecom-config-layout {
  align-items: start;
}

.wecom-config-layout + .wecom-config-layout {
  margin-top: 18px;
}

.wecom-config-layout > .panel {
  min-width: 0;
}

.wecom-config-layout .history-list {
  max-height: 420px;
  overflow-y: auto;
}

.config-subsection + .config-subsection {
  margin-top: 16px;
}

.config-subhead {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.wecom-config-layout .history-item > span {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.wecom-config-layout .history-item > span + span {
  margin-top: 4px;
}

.asset-assistant-panel {
  margin-top: 18px;
}

.asset-assistant-model {
  color: var(--muted);
  font-size: 12px;
}

.asset-assistant-messages {
  min-height: 180px;
  max-height: 360px;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--soft);
}

.asset-assistant-message {
  width: fit-content;
  max-width: min(760px, 86%);
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.asset-assistant-message.user {
  margin-left: auto;
  border-color: #84adff;
  background: #eff4ff;
}

.asset-assistant-message ul {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-family: Consolas, "Microsoft YaHei UI", monospace;
  font-size: 12px;
}

.asset-assistant-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 10px;
}

.asset-assistant-composer .textarea {
  min-height: 82px;
  resize: vertical;
}

.asset-assistant-composer .primary-btn {
  min-width: 112px;
}

.hidden {
  display: none;
}

.login-page {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  gap: 16px;
}

.login-panel h1 {
  margin: 0;
  font-size: 22px;
}

.login-panel p {
  margin: -8px 0 4px;
  color: var(--muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes progress-slide {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(80%);
  }
  100% {
    transform: translateX(240%);
  }
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
  }
  nav {
    grid-auto-flow: column;
    overflow: auto;
  }
  #view-review .page-head,
  #view-models .page-head {
    align-items: stretch;
    flex-direction: column;
  }
  #view-models .page-head > button {
    align-self: flex-start;
  }
  #view-review .review-selectors {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .workbench,
  .history-layout,
  .history-source-grid {
    grid-template-columns: 1fr;
  }
  #view-history > .history-layout {
    grid-template-columns: 1fr;
  }
  #view-history .history-source-grid {
    grid-template-columns: 1fr;
  }
  .history-preview-panel {
    position: static;
    min-height: 420px;
  }
  #history-output {
    max-height: none;
  }
  .history-item-detail {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #view-history .history-file-list {
    grid-auto-rows: minmax(var(--history-file-row-height), auto);
  }
  .report-audit-snapshot dl {
    grid-template-columns: 84px minmax(0, 1fr);
  }
  .model-grid {
    grid-template-columns: 1fr;
  }
  .review-profile-card-head,
  .review-profile-grid {
    grid-template-columns: 1fr;
  }
  .external-api-value-row {
    grid-template-columns: 1fr;
  }
  .permission-multi-grid {
    grid-template-columns: 1fr;
  }
  .rpa-time-range {
    grid-template-columns: 1fr;
  }
  .reimbursement-result-grid {
    grid-template-columns: 1fr;
  }
  .reimbursement-system-summary {
    grid-template-columns: 1fr;
  }
  .monitoring-status-strip,
  .monitoring-grid,
  .monitoring-metrics {
    grid-template-columns: 1fr;
  }
  .monitoring-status-strip > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .monitoring-status-strip > div:last-child {
    border-bottom: 0;
  }
  .monitoring-metrics > div:nth-child(odd),
  .monitoring-metrics > div:nth-child(even) {
    padding-right: 0;
    padding-left: 0;
    border-left: 0;
  }
  .monitoring-metrics > div:nth-last-child(2) {
    border-bottom: 1px solid var(--line);
  }
  .monitoring-table {
    table-layout: fixed;
  }
  .monitoring-table th,
  .monitoring-table td {
    padding: 9px 6px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .monitoring-table th:nth-child(1) { width: 20%; }
  .monitoring-table th:nth-child(2) { width: 29%; }
  .monitoring-table th:nth-child(3) { width: 21%; }
  .monitoring-table th:nth-child(4) { width: 30%; }
  .monitoring-user-panel .select {
    width: 120px;
    flex-basis: 120px;
  }
  .monitoring-user-table,
  .monitoring-user-table tbody {
    display: block;
    min-width: 0;
    table-layout: auto;
  }
  .monitoring-user-table thead {
    display: none;
  }
  .monitoring-user-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
  }
  .monitoring-user-table tbody tr:last-child {
    border-bottom: 0;
  }
  .monitoring-user-table td {
    display: flex;
    min-width: 0;
    padding: 8px;
    border: 0;
    flex-direction: column;
    gap: 4px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .monitoring-user-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 11px;
  }
  .monitoring-user-table .monitoring-user-empty {
    grid-column: 1 / -1;
  }
  .monitoring-user-table .monitoring-user-empty::before {
    content: none;
  }
  .reimbursement-review-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .reimbursement-review-actions > div {
    margin-left: 0;
  }
  .reimbursement-history-item,
  .reimbursement-history-side {
    align-items: flex-start;
    flex-direction: column;
  }
  .reimbursement-batch > summary {
    align-items: flex-start;
    flex-direction: column;
  }
  .reimbursement-batch-documents {
    padding-left: 8px;
  }
}

@media (max-width: 600px) {
  #view-review .review-selectors {
    grid-template-columns: 1fr;
  }
}
