/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-dark:   #1A569A;
  --blue-mid:    #2563EB;
  --blue-light:  #DBEAFE;
  --amber:       #F59E0B;
  --green:       #10B981;
  --red:         #EF4444;
  --orange:      #D9530C;
  --gray-50:     #F8FAFC;
  --gray-100:    #F1F5F9;
  --gray-200:    #E2E8F0;
  --gray-400:    #94A3B8;
  --gray-600:    #475569;
  --gray-800:    #1E293B;
  --radius:      10px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  background: var(--blue-dark);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.3px;
}
nav { display: flex; gap: 8px; }
.nav-link {
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: .9rem;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.15); color: white; }

/* ── Main ── */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── Panel ── */
.panel {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}
.panel-header {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.panel-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--gray-800); }
.panel-header h2 { font-size: 1.25rem; font-weight: 600; color: var(--gray-800); }
.subtitle { color: var(--gray-600); font-size: .95rem; margin-top: 6px; line-height: 1.5; }

/* ── Form ── */
.form-group { margin-bottom: 24px; }
label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: .9rem;
  color: var(--gray-800);
  margin-bottom: 8px;
}
.badge {
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: .75rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
}
input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
input[type="text"]:focus {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
input[type="range"] {
  width: 100%;
  accent-color: var(--blue-mid);
  cursor: pointer;
}
.range-value {
  background: var(--blue-dark);
  color: white;
  font-size: .78rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  min-width: 28px;
  text-align: center;
}
.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  color: var(--gray-400);
  margin-top: 4px;
}

/* ── Drop Zone ── */
.drop-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--gray-50);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--blue-mid);
  background: var(--blue-light);
}
.drop-zone p { color: var(--gray-600); font-size: .95rem; margin-top: 10px; }
.drop-zone .drop-hint { font-size: .82rem; color: var(--gray-400); margin-top: 4px; }
.file-link {
  color: var(--blue-mid);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 500;
  margin: 0;
  display: inline;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.file-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--gray-100);
  border-radius: 8px;
  font-size: .88rem;
}
.file-icon { font-size: 1.1rem; }
.file-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--gray-400); font-size: .8rem; white-space: nowrap; }
.file-remove {
  background: none; border: none; cursor: pointer; color: var(--gray-400);
  padding: 2px; border-radius: 4px; line-height: 1;
}
.file-remove:hover { color: var(--red); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--blue-dark);
  color: white;
  box-shadow: 0 2px 8px rgba(26,86,154,.3);
}
.btn-primary:hover { background: var(--blue-mid); box-shadow: 0 4px 16px rgba(37,99,235,.35); }
.btn-primary:disabled { background: var(--gray-400); box-shadow: none; cursor: not-allowed; }
.btn-ghost {
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
}
.btn-ghost:hover { background: var(--gray-200); }
.btn-sm { padding: 7px 14px; font-size: .85rem; }

.form-actions { display: flex; flex-direction: column; gap: 10px; }
.hint { font-size: .83rem; color: var(--gray-400); }

/* ── Progress ── */
.progress-bar-wrap {
  height: 8px;
  background: var(--gray-100);
  border-radius: 99px;
  overflow: hidden;
  margin: 16px 0 8px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue-mid));
  border-radius: 99px;
  transition: width .4s ease;
}
.progress-msg {
  font-size: .9rem;
  color: var(--gray-600);
  min-height: 1.4em;
  line-height: 1.4;
}
.job-meta { margin-bottom: 4px; }
.mono { font-family: monospace; font-size: .78rem; color: var(--gray-400); }

/* ── Job Result / Error ── */
.job-result h3, .job-error h3 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.output-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.output-list li a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--blue-mid);
  text-decoration: none;
  font-weight: 500;
  font-size: .92rem;
}
.output-list li a:hover { text-decoration: underline; }

.job-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}
.job-error h3 { color: var(--red); }
.job-error pre {
  font-size: .78rem;
  overflow: auto;
  max-height: 200px;
  color: #7F1D1D;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Status Badges ── */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 600;
  text-transform: capitalize;
}
.status-pending  { background: #FEF3C7; color: #92400E; }
.status-running  { background: var(--blue-light); color: var(--blue-dark); }
.status-complete { background: #D1FAE5; color: #065F46; }
.status-error    { background: #FEE2E2; color: #991B1B; }

/* ── Jobs Table ── */
.jobs-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.jobs-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--gray-200);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-400);
}
.jobs-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.jobs-table tr:hover td { background: var(--gray-50); }
.jobs-table .title-cell { font-weight: 500; }
.jobs-table .action-btn {
  background: none; border: none; color: var(--blue-mid);
  cursor: pointer; font-size: .85rem; font-weight: 500;
  padding: 4px 0;
  text-decoration: underline;
}

.empty-state { color: var(--gray-400); font-size: .95rem; text-align: center; padding: 32px 0; }
.hidden { display: none !important; }

/* ── Footer ── */
footer {
  text-align: center;
  padding: 20px;
  font-size: .82rem;
  color: var(--gray-400);
  border-top: 1px solid var(--gray-200);
}

/* ── Spinner animation ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
