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

:root {
  --blue:    #2563eb;
  --blue-lt: #eff6ff;
  --blue-dk: #1d4ed8;
  --green:   #16a34a;
  --green-lt:#dcfce7;
  --amber:   #d97706;
  --amber-lt:#fef3c7;
  --red:     #dc2626;
  --red-lt:  #fee2e2;
  --gray-50: #f9fafb;
  --gray-100:#f3f4f6;
  --gray-200:#e5e7eb;
  --gray-400:#9ca3af;
  --gray-600:#4b5563;
  --gray-800:#1f2937;
  --radius:  8px;
  --shadow:  0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: var(--blue);
  color: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
header svg { flex-shrink: 0; }
header h1 { font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em; }
header span.sub { font-size: .8rem; opacity: .75; margin-left: 4px; }

/* ── Layout ── */
main {
  max-width: 760px;
  margin: 32px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Cards ── */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card h2 {
  font-size: .875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-600);
  margin-bottom: 16px;
}

/* ── Forms ── */
label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: 6px; color: var(--gray-800); }
input[type="text"], input[type="password"] {
  width: 100%;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: .9rem;
  outline: none;
  transition: border-color .15s;
}
input[type="text"]:focus, input[type="password"]:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-dk); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-ghost { background: var(--gray-100); color: var(--gray-800); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-200); }

/* ── Key row ── */
.key-row { display: flex; gap: 10px; align-items: flex-end; }
.key-row > div { flex: 1; }

/* ── Connected badge ── */
#conn-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
#conn-status.connected { background: var(--green-lt); color: var(--green); }
#conn-status.disconnected { background: var(--gray-100); color: var(--gray-600); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ── Error / info banners ── */
.banner {
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .875rem;
  display: none;
}
.banner.show { display: block; }
.banner.error { background: var(--red-lt); color: var(--red); border: 1px solid #fca5a5; }
.banner.info  { background: var(--blue-lt); color: var(--blue-dk); border: 1px solid #bfdbfe; }

/* ── Drop zone ── */
#drop-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 14px;
}
#drop-zone.drag-over { border-color: var(--blue); background: var(--blue-lt); }
#drop-zone svg { margin-bottom: 12px; opacity: .4; }
#drop-zone p { font-size: .9rem; color: var(--gray-600); margin-bottom: 6px; }
#drop-zone small { font-size: .78rem; color: var(--gray-400); }
#file-name { font-size: .85rem; font-weight: 600; color: var(--blue); margin-top: 8px; }

.upload-actions { display: flex; gap: 10px; align-items: center; }

/* ── Jobs list ── */
#jobs-list { display: flex; flex-direction: column; gap: 10px; }
.job-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .875rem;
}
.job-id { font-family: monospace; font-size: .8rem; color: var(--gray-600); min-width: 72px; }
.job-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge.queued  { background: var(--gray-100); color: var(--gray-600); }
.badge.running { background: var(--amber-lt); color: var(--amber); }
.badge.done    { background: var(--green-lt); color: var(--green); }
.badge.failed  { background: var(--red-lt);   color: var(--red); }
.badge.unknown { background: var(--gray-100); color: var(--gray-600); }

/* spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 10px; height: 10px; border: 2px solid transparent; border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }

.empty-jobs { text-align: center; color: var(--gray-400); font-size: .875rem; padding: 24px 0; }

/* ── Upload section hidden by default ── */
#upload-section { display: none; }
#upload-section.visible { display: block; }
#jobs-section { display: none; }
#jobs-section.visible { display: block; }

/* ── Marketing / content pages ── */
.prose { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.prose h2 { font-size: 1.4rem; margin: 28px 0 12px; color: var(--gray-800); text-transform: none; letter-spacing: 0; }
.prose h3 { font-size: 1.1rem; margin: 20px 0 8px; }
.prose p  { line-height: 1.65; margin-bottom: 14px; color: var(--gray-800); }
.prose ul { margin: 0 0 14px 22px; line-height: 1.65; }
.prose code, .prose pre { background: var(--gray-100); border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.prose code { padding: 1px 5px; }
.prose pre  { padding: 14px; overflow-x: auto; margin-bottom: 14px; }
.lead { font-size: 1.05rem; color: var(--gray-600); margin-bottom: 20px; }
.cta { display:inline-flex; align-items:center; gap:6px; padding:11px 22px; border-radius: var(--radius); background: var(--blue); color:#fff; font-weight:600; text-decoration:none; }
.cta:hover { background: var(--blue-dk); }
.sample-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap:12px; margin: 14px 0 22px; }
.sample-grid figure { margin:0; }
.sample-grid img { width:100%; height:auto; aspect-ratio:16/9; object-fit:cover; border:1px solid var(--gray-200); border-radius:6px; display:block; }
.sample-grid figcaption { font-size:.78rem; color:var(--gray-600); margin-top:6px; text-align:center; }
.faq dt { font-weight:600; margin-top:16px; }
.faq dd { margin:6px 0 0; color: var(--gray-600); line-height:1.6; }
.site-footer { max-width:760px; margin:48px auto 24px; padding:24px 16px; border-top:1px solid var(--gray-200); color:var(--gray-600); font-size:.85rem; }
.site-footer nav { display:flex; flex-wrap:wrap; gap:14px; margin-bottom:10px; }
.site-footer a { color: var(--blue); text-decoration:none; }
@media (max-width:560px){ .sample-grid{ grid-template-columns:1fr; } }
