:root {
  --page-bg: #f3f3f4;
  --panel-bg: #ffffff;
  --border: #e5e7eb;
  --text: #2b2f33;
  --muted: #6b7280;
  --blue: #1c84c6;
  --navy: #1ab394;
  --red: #ed5565;
  --lazur: #23c6c8;
  --yellow: #f8ac59;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--page-bg);
}

#app {
  min-height: 100vh;
}

.content {
  padding: 24px;
}

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.title-row h1 {
  margin: 0;
  font-size: 34px;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.project-pill {
  background: #fff;
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.stat-card {
  color: #fff;
  padding: 18px;
  border-radius: 6px;
}

.stat-card.successful {
  background: var(--navy);
}

.stat-card.faulted {
  background: var(--red);
}

.stat-card.new {
  background: var(--lazur);
}

.stat-card.in-progress {
  background: var(--yellow);
}

.stat-label {
  opacity: 0.9;
  font-size: 14px;
}

.stat-value {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 700;
}

.toolbar,
.table-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.toolbar input,
.toolbar select {
  min-width: 150px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
}

.btn {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 9px 12px;
  background: #fff;
  cursor: pointer;
}

.btn:hover {
  opacity: 0.92;
}

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

.table-card {
  margin-top: 18px;
}

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

.toast {
  min-height: 20px;
  color: var(--blue);
  font-size: 13px;
}

.table-wrapper {
  overflow: auto;
  max-height: 560px;
}

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

thead th {
  position: sticky;
  top: 0;
  background: #f9fafb;
  z-index: 1;
  cursor: pointer;
}

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

td .cell {
  max-width: 220px;
  white-space: normal;
  word-break: break-word;
}

td .aid-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
}

.param-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-width: 220px;
  max-width: 360px;
  font-size: 13px;
  line-height: 1.45;
}

.param-list span {
  overflow-wrap: anywhere;
}

.param-list b {
  color: var(--muted);
}

.status-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
}

.status-pill.successful {
  background: var(--navy);
}

.status-pill.faulted {
  background: var(--red);
}

.status-pill.new {
  background: var(--lazur);
}

.status-pill.in-progress {
  background: var(--yellow);
}

.pagination-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: 14px;
  flex-wrap: wrap;
}

.page-size-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.page-size-control select {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 28px 8px 10px;
  color: var(--text);
  background: #fff;
}

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

.modal.hidden {
  display: none;
}

.modal-panel {
  width: min(860px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: #fff;
  padding: 16px 18px;
}

.modal-header h2 {
  margin: 0;
}

.modal-body {
  padding: 18px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px 16px;
}

.detail-key {
  color: var(--muted);
  font-weight: 700;
}

.detail-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-section-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

.detail-params {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.detail-param-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px 12px;
}

.detail-param-key {
  color: var(--muted);
  font-weight: 700;
}

.detail-param-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-json {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
}

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

@media (max-width: 700px) {
  .content {
    padding: 14px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}
