:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #64748b;
  --accent: #3b82f6;
  --green: #22c55e;
  --yellow: #f59e0b;
  --red: #ef4444;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 40px;
  width: 360px;
}
.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.subtitle { color: var(--muted); margin-bottom: 24px; }
.error {
  color: var(--red);
  background: rgba(239,68,68,.1);
  border: 1px solid var(--red);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 16px;
  font-size: 13px;
}
.field { margin-bottom: 16px; }
.field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
}
.field input:focus { outline: none; border-color: var(--accent); }
button[type=submit], .btn {
  width: 100%;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 10px;
}
button[type=submit]:hover, .btn:hover { opacity: .9; }

/* App shell */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 48px;
}
.nav-brand { font-weight: 700; font-size: 15px; }
.nav-tab {
  color: var(--muted);
  cursor: pointer;
  padding: 14px 0;
  border-bottom: 2px solid transparent;
  font-size: 13px;
}
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav-logout {
  margin-left: auto;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  width: auto;
}
.nav-logout:hover { color: var(--text); opacity: 1; }

/* Tabs */
.tab { display: none; padding: 24px 20px; max-width: 900px; margin: 0 auto; }
.tab.active { display: block; }

/* Form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-full { margin-bottom: 16px; }
.form-row { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.form-row .field { margin-bottom: 0; }
label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
textarea, input[type=text], select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
}
textarea { resize: vertical; }
textarea:focus, input[type=text]:focus, select:focus { outline: none; border-color: var(--accent); }
select { cursor: pointer; }
.btn-generate {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 24px;
  white-space: nowrap;
  width: auto;
}
.btn-generate:disabled { opacity: .5; cursor: not-allowed; }

/* History */
.history-list { display: grid; gap: 10px; }
.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.running { background: var(--yellow); }
.status-dot.done    { background: var(--green); }
.status-dot.failed  { background: var(--red); }
.job-info { flex: 1; min-width: 0; }
.job-title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.job-error { color: var(--red); font-size: 12px; margin-top: 3px; }
.job-progress { background: var(--border); border-radius: 3px; height: 4px; margin-top: 8px; overflow: hidden; }
.job-progress-bar { background: var(--yellow); height: 100%; border-radius: 3px; transition: width .3s; }
.job-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-download {
  background: #1d4ed8;
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  padding: 5px 12px;
}
.btn-delete {
  background: var(--border);
  border: none;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 5px 10px;
}
.btn-delete:hover { color: var(--red); }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* Cat AI badge */
.job-badge {
  display: inline-block;
  background: #7c3aed;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: .3px;
}
