:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --line: #e9ecf3;
  --line-2: #eef0f6;
  --line-strong: #e2e5ef;
  --text: #1d2330;
  --text-2: #5b6273;
  --text-3: #6f7688;
  --muted: #8b92a3;
  --primary: #5b5bd6;
  --primary-strong: #4a4ac4;
  --primary-soft: #eef0ff;
  --success: #16a34a;
  --success-soft: #e8f7ee;
  --danger: #dc2626;
  --danger-soft: #fdeeee;
  --info: #2563eb;
  --info-soft: #e9f1ff;
  --warn: #d97706;
  --radius: 13px;
  --sidebar-w: 208px;
  --topbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --shadow-card: 0 1px 2px rgba(20, 26, 46, 0.035), 0 8px 24px rgba(20, 26, 46, 0.025);
  --shadow-pop: 0 18px 44px rgba(24, 29, 54, 0.14);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

::selection {
  background: #deddff;
  color: #2b2b6b;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-thumb {
  background: #d7dae6;
  border-radius: 9px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #c3c7d7;
  background-clip: content-box;
  border: 2px solid transparent;
}

::-webkit-scrollbar-track {
  background: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(91, 91, 214, 0.45);
  outline-offset: 2px;
}

.icon {
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.16s, border-color 0.16s, color 0.16s, box-shadow 0.16s;
}

.btn:hover {
  border-color: #ced2e2;
  color: var(--text);
  background: #fbfbfe;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: linear-gradient(180deg, #6a67e2 0%, #5b5bd6 100%);
  border-color: #5656cd;
  color: #fff;
  box-shadow: 0 6px 16px rgba(91, 91, 214, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #5f5cd8 0%, #4f4fca 100%);
  border-color: #4c4cc2;
  color: #fff;
}

.btn-primary:disabled {
  box-shadow: none;
}

.btn-soft {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
}

.btn-soft:hover {
  background: #e6e7ff;
  border-color: transparent;
  color: var(--primary-strong);
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12px;
}

.btn-sm svg {
  width: 13px;
  height: 13px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #6d7487;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: #f3f4fa;
  color: var(--text);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.input {
  height: 34px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.input::placeholder {
  color: #a7acbc;
}

.input:hover {
  border-color: #d3d7e5;
}

.input:focus {
  border-color: #b7b8f4;
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.08);
}

.select {
  position: relative;
  display: inline-flex;
}

.select select {
  appearance: none;
  -webkit-appearance: none;
  height: 34px;
  max-width: 200px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  text-overflow: ellipsis;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.select select:hover {
  border-color: #d3d7e5;
}

.select select:focus {
  border-color: #b7b8f4;
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.08);
}

.select .select-chevron {
  position: absolute;
  top: 50%;
  right: 9px;
  width: 14px;
  height: 14px;
  color: #9aa1b2;
  transform: translateY(-50%);
  pointer-events: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f2f3f7;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.badge.badge-success {
  background: var(--success-soft);
  color: #15803d;
}

.badge.badge-failed {
  background: var(--danger-soft);
  color: #cf3a3a;
}

.badge.badge-processing {
  background: var(--info-soft);
  color: #2563eb;
}

.badge.badge-pending {
  background: #f2f3f7;
  color: #6b7280;
}

.export-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  margin-left: 6px;
  padding: 0 7px;
  border: 1px solid #e0e1fb;
  border-radius: 999px;
  background: #f8f8ff;
  color: #6c63dd;
  font-size: 11px;
  white-space: nowrap;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: none;
  background: none;
  color: var(--primary);
  font-size: 12.8px;
  font-weight: 500;
}

.link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

table.data th {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: #8f95a7;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

table.data td {
  padding: 13px 16px;
  border-bottom: 1px solid #f1f3f8;
  color: var(--text-2);
  font-size: 13px;
  vertical-align: middle;
}

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

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

table.data .check-col {
  width: 42px;
  padding-right: 0;
}

input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(91, 91, 214, 0.16);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner.small {
  width: 14px;
  height: 14px;
  border-width: 1.6px;
}

.spin-slow {
  animation: spin 3.6s linear infinite;
}

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

.view-loading {
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 20px;
  color: var(--muted);
  font-size: 13.5px;
}

.empty-ico {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid #e9ebf3;
  border-radius: 15px;
  background: #f5f6fa;
  color: #a3a9ba;
}

.empty-ico svg {
  width: 24px;
  height: 24px;
}

.empty.compact {
  padding: 34px 20px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
