:root {
  --bg: #f0f4f8;
  --bg2: #e2e8f0;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --line: #e2e8f0;
  --text: #1e293b;
  --text-soft: #64748b;
  --text-main: #f8fafc;
  --primary: #00bfa5;
  --primary-2: #009e88;
  --primary-dark: #009e88;
  --danger: #ef4444;
  --ok: #10b981;
  --running: #0ea5e9;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-shell {
  min-width: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.page {
  padding: 32px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.hero {
  margin-bottom: 32px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
}

.hero p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.6;
}

.anim-in {
  animation: fadeIn 0.3s ease both;
  animation-delay: var(--delay, 0s);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-card {
  min-height: 200px;
}

.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.log-btn {
  border: 1px solid rgba(255,255,255,.2);
  color: #f1f5f9;
  background: rgba(255,255,255,.1);
  border-radius: 6px;
  padding: 8px 12px;
  transition: background 0.2s;
}

.log-btn:hover { background: rgba(255,255,255,.15); }

.status-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #f1f5f9;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8794bf;
}

.status-chip.running .status-dot { background: var(--running); }
.status-chip.success .status-dot { background: var(--ok); }
.status-chip.error .status-dot { background: var(--danger); }

.page {
  display: none;
  padding: 18px 24px 28px;
  max-width: 1080px;
}

.page.active {
  display: block;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: #0f172a;
}

.badge-count {
  background: #e0f2fe;
  color: #0284c7;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}

.search-bar-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 24px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-icon {
  font-size: 16px;
  color: #94a3b8;
}

.search-bar input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 14px;
  color: var(--text);
  background: transparent;
}

.project-table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

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

.project-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.project-table td {
  padding: 16px;
  font-size: 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: #334155;
}

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

.project-table tr:hover td {
  background: #f8fafc;
}

.proj-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.proj-icon {
  width: 36px;
  height: 36px;
  background: #ccfbf1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

.proj-name {
  font-weight: 500;
  font-size: 14px;
  color: #0f172a;
}

.proj-type {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.status-badge.active {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.action-btn {
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s;
}

.action-btn.view {
  color: var(--primary);
}

.action-btn.del {
  color: var(--danger);
}

.action-btn:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: #64748b;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 16px;
  color: #cbd5e1;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.back-btn {
  background: #fff;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 14px;
  color: #334155;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.back-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

.detail-project-name {
  font-size: 20px;
  font-weight: 600;
  color: #0f172a;
}

.uploaded-list-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.uploaded-list-section + .uploaded-list-section {
  margin-top: 24px;
}

.uploaded-list-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  margin: 0 0 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.uploaded-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  margin-bottom: 8px;
}

.uploaded-item:last-child {
  margin-bottom: 0;
}

.uploaded-item-icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
  color: #0f766e;
  flex-shrink: 0;
}

.uploaded-item-name {
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uploaded-item-type {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.hero h1 {
  margin: 0;
  font-size: 48px;
  line-height: 1.08;
  letter-spacing: .5px;
}

.hero p {
  margin: 8px 0 16px;
  color: #9aa8d6;
}

.card {
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h2 {
  margin: 0;
  font-size: 20px;
  color: #0f172a;
  font-weight: 600;
}

.count-badge {
  font-size: 13px;
  color: #64748b;
  background: #f1f5f9;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 500;
}

.upload-sections {
  display: grid;
  gap: 24px;
}

.upload-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 20px;
}

.upload-section-head {
  margin-bottom: 16px;
}

.upload-section-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
  color: #0f172a;
  font-weight: 600;
}

.upload-section-head p {
  margin: 0;
  font-size: 13px;
  color: #64748b;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  padding: 12px 14px;
  resize: vertical;
  min-height: 120px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 191, 165, 0.2);
}

.upload-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
}

.dropzone {
  position: relative;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  background: #fff;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.2s;
  cursor: pointer;
}

.dropzone.dragover, .dropzone:hover { border-color: var(--primary); background: #f0fdfa; color: var(--primary-2); }

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  gap: 8px;
}
.dropzone-main { margin: 0; font-size: 14px; font-weight: 500; color: #0f172a; }
.dropzone-hint { margin: 0; font-size: 12px; color: #64748b; padding: 0 10px; }
.dropzone-icon { display: block; stroke: currentColor; }

.file-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 140px;
  display: flex;
  flex-direction: column;
}

.preview {
  flex: 1;
  padding: 12px;
  overflow: auto;
}

.file-empty {
  color: #94a3b8;
  font-size: 13px;
  line-height: 28px;
  text-align: center;
  margin-top: 30px;
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
  border-radius: 6px;
  margin-bottom: 6px;
}

.file-row:last-child { margin-bottom: 0; }

.file-name {
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-actions {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
  border-radius: 0 0 8px 8px;
}

button {
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: #334155;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.98); }

.remove-btn.inline {
  background: transparent;
  color: var(--danger);
  border: none;
  padding: 4px;
  font-size: 14px;
}

.remove-btn.inline:hover { background: #fee2e2; border-radius: 4px; }

.hint { margin: 8px 0 0; font-size: 13px; color: #64748b; }
.hint.error { color: var(--danger); }
.hint.success { color: var(--ok); }

.cta-wrap { display: flex; justify-content: center; margin: 24px 0; }

.btn-primary.cta-btn {
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 14px 48px;
  font-weight: 600;
  font-size: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 191, 165, 0.2), 0 2px 4px -2px rgba(0, 191, 165, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary.cta-btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 10px 15px -3px rgba(0, 191, 165, 0.3), 0 4px 6px -4px rgba(0, 191, 165, 0.3); }
.btn-primary.cta-btn:active { transform: translateY(0); }

.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; }

.progress-wrap { margin-bottom: 16px; }

.progress-bar { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
  position: relative;
}

.progress-bar span.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer { to { transform: translateX(100%); } }

.progress-text { margin-top: 8px; color: #64748b; font-size: 13px; font-weight: 500; }

.workflow-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin-top: 8px;
}

.workflow-step {
  min-width: 0;
  flex: 0 1 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  color: #94a3b8;
  position: relative;
  z-index: 1;
}

.workflow-step-circle {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 2px solid #cbd5e1;
  background: #fff;
  color: #94a3b8;
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.workflow-step-label {
  font-size: 13px;
  line-height: 1.45;
  font-weight: 500;
}

.workflow-step-line {
  flex: 1 1 72px;
  min-width: 40px;
  max-width: 88px;
  height: 2px;
  background: #cbd5e1;
  margin: 20px 10px 0;
  transition: background 0.25s ease;
}

.workflow-step-line.active {
  background: linear-gradient(90deg, var(--primary) 0%, rgba(0, 191, 165, 0.28) 100%);
}

.workflow-step-line.done {
  background: var(--primary);
}

.workflow-step.active .workflow-step-circle {
  border-color: var(--primary);
  color: var(--primary);
  background: #f0fdfa;
  box-shadow: 0 0 0 4px rgba(0, 191, 165, 0.12);
  color: var(--primary);
}

.workflow-step.done {
  color: #0f172a;
}

.workflow-step.done .workflow-step-circle {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.result-text {
  min-height: 240px;
  margin: 0;
  white-space: pre-wrap;
  background: #f8fafc;
  color: #334155;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  font-family: inherit;
}

.workflow-json-modal {
  width: min(900px, 100%);
  text-align: left;
}

.workflow-json-text {
  min-height: 320px;
  max-height: min(65vh, 720px);
  overflow: auto;
  margin: 0 0 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.5;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1024px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,.08);
    padding-bottom: 10px;
  }
  .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .side-item { flex: 1 1 calc(33% - 8px); text-align: center; }
}

@media (max-width: 768px) {
  .page { padding: 14px; }
  .hero h1 { font-size: 36px; }
  .upload-grid { grid-template-columns: 1fr; }
  .upload-section { padding: 12px; }
  .workflow-steps {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }
  .workflow-step {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
  }
  .workflow-step-line {
    width: 2px;
    height: 22px;
    min-width: 2px;
    max-width: 2px;
    margin: -2px 0 -2px 20px;
    background: #cbd5e1;
  }
  .workflow-step-line.active {
    background: linear-gradient(180deg, var(--primary) 0%, rgba(0, 191, 165, 0.28) 100%);
  }
  .workflow-step-line.done {
    background: var(--primary);
  }
}

.app-shell { min-height: 100vh; }
.topbar { justify-content: space-between; }
.user-menu-wrap { position: relative; }

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.1);
  color: #f8fafc;
  border-radius: 999px;
  padding: 4px 12px 4px 6px;
  transition: background 0.2s;
}

.user-menu-trigger:hover { background: rgba(255,255,255,0.15); }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.username-label { font-size: 14px; font-weight: 500; }

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 156px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  padding: 4px;
  z-index: 40;
}

.user-menu-item {
  width: 100%;
  text-align: left;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  padding: 8px 12px;
  font-size: 14px;
  transition: background 0.2s;
}

.user-menu-item:hover { background: #f1f5f9; }
.user-menu-item.danger { color: var(--danger); }

.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
}

.auth-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 32px;
}

.auth-card-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  flex-shrink: 0;
}
.auth-brand-text span { color: #64748b; }
.auth-title { margin: 0 0 10px; font-size: 24px; color: #0f172a; font-weight: 600; }
.auth-subtitle { margin: 0 0 20px; color: #64748b; line-height: 1.6; font-size: 14px; }

.auth-form, .password-form { display: flex; flex-direction: column; gap: 16px; }

.auth-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 191, 165, 0.2);
}

.auth-error { margin: 0; font-size: 13px; color: var(--danger); }
.auth-submit { width: 100%; margin-top: 8px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
  backdrop-filter: blur(4px);
}

.modal-card {
  width: min(480px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  color: var(--primary);
  background: #f0fdfa;
  margin: 0 auto 20px;
}

.modal-title {
  margin: 0 0 24px;
  font-size: 20px;
  color: #0f172a;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

@media (max-width: 768px) {
  .topbar {
    flex-wrap: wrap;
    justify-content: flex-end;
    height: auto;
    padding: 10px 14px;
  }

  .auth-card {
    padding: 24px 20px;
  }
}

