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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242736;
  --border: #2e3245;
  --text: #e4e6ef;
  --text2: #8b8fa3;
  --accent: #6c5ce7;
  --accent2: #a29bfe;
  --green: #00b894;
  --yellow: #fdcb6e;
  --red: #e17055;
  --blue: #74b9ff;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 { font-size: 18px; font-weight: 600; }
header .user-info { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text2); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 { font-size: 16px; margin-bottom: 12px; color: var(--accent2); }

/* Forms */
label {
  display: block;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 4px;
  margin-top: 12px;
}

input, select, textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

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

.btn {
  display: inline-block;
  padding: 8px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-danger { background: var(--red); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text2); }

/* Status badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-queued { background: var(--surface2); color: var(--text2); }
.badge-running { background: rgba(108, 92, 231, 0.2); color: var(--accent2); }
.badge-completed { background: rgba(0, 184, 148, 0.2); color: var(--green); }
.badge-failed { background: rgba(225, 112, 85, 0.2); color: var(--red); }
.badge-awaiting_input { background: rgba(253, 203, 110, 0.2); color: var(--yellow); }

/* Grid */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 350px 1fr; }

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Table */
.job-list { width: 100%; }

.job-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.job-row:hover { background: var(--surface2); }
.job-row .workflow { font-weight: 500; min-width: 120px; }
.job-row .keyword { flex: 1; color: var(--text2); font-size: 14px; }
.job-row .time { font-size: 12px; color: var(--text2); min-width: 100px; text-align: right; }

/* Logs */
.log-area {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  max-height: 400px;
  overflow-y: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.5;
}

.log-line { padding: 2px 0; }
.log-line .time { color: var(--text2); margin-right: 8px; }
.log-line.error { color: var(--red); }

/* File list */
.file-list { list-style: none; }
.file-list li {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.file-list li:last-child { border-bottom: none; }

/* Login */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-card {
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.login-card h1 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 20px;
}

.login-card .btn { width: 100%; margin-top: 20px; }

.error-msg { color: var(--red); font-size: 13px; margin-top: 8px; }

/* Progress bar animation */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Hidden */
.hidden { display: none !important; }

/* Dynamic fields hint */
.field-hint { font-size: 12px; color: var(--text2); margin-top: 2px; }
.required-star { color: var(--red); }
