/* ===================================================================
   applycling workbench — minimal dense dark-theme CSS
   =================================================================== */

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

:root {
  --bg:        #111827;
  --bg-card:   #1f2937;
  --bg-hover:  #374151;
  --border:    #374151;
  --text:      #f3f4f6;
  --text-dim:  #9ca3af;
  --text-muted:#6b7280;
  --accent:    #3b82f6;
  --radius:    6px;
  --sidebar-w: 200px;
}

body.dark {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
}

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

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.brand-link {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.brand-link:hover { color: var(--accent); }

.nav-list {
  list-style: none;
  padding: 8px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.1s;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active {
  background: var(--bg-hover);
  color: var(--text);
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-footer .nav-item {
  color: var(--accent);
  font-weight: 600;
  padding: 6px 0;
}

/* ── Content ──────────────────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 24px 32px;
  max-width: 1100px;
  min-width: 0;
}

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

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
}

.back-link {
  color: var(--text-dim);
  font-size: 13px;
}

.muted-text {
  color: var(--text-dim);
  font-size: 13px;
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  text-decoration: none;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:active { background: var(--border); }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #2563eb; }

.btn-sm { padding: 3px 10px; font-size: 12px; }

.btn-start { border-color: #f59e0b; color: #f59e0b; }
.btn-start:hover { background: #f59e0b; color: #111827; }

.btn-apply { border-color: #8b5cf6; color: #8b5cf6; }
.btn-apply:hover { background: #8b5cf6; color: #fff; }

.btn-skip { border-color: #ef4444; color: #ef4444; }
.btn-skip:hover { background: #ef4444; color: #fff; }

.btn-reopen { border-color: var(--text-dim); color: var(--text-dim); }
.btn-reopen:hover { background: var(--text-dim); color: #111827; }

/* ── Status badges ────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  color: #111827;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.status-badge-lg {
  padding: 4px 12px;
  font-size: 13px;
}

/* ── Job table ────────────────────────────────────────────────────── */
.jobs-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
}

.jobs-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.jobs-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.job-row:hover { background: var(--bg-hover); }

.job-link {
  color: var(--text);
  font-weight: 500;
}
.job-link:hover { color: var(--accent); }

.has-package {
  margin-left: 6px;
  font-size: 12px;
}

.cell-company {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-title { min-width: 200px; }
.cell-date { color: var(--text-dim); font-size: 12px; white-space: nowrap; }

.cell-actions {
  white-space: nowrap;
}

.inline-form {
  display: inline-block;
  margin-right: 4px;
}

.applied-mark {
  color: #8b5cf6;
  font-weight: 600;
  font-size: 13px;
}

/* ── Empty state ──────────────────────────────────────────────────── */
.empty-state {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--text-dim);
}

/* ── Job detail ───────────────────────────────────────────────────── */
.job-detail-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

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

.job-detail-header h1 {
  font-size: 20px;
  font-weight: 700;
}

.job-meta {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 16px;
  font-size: 13px;
  margin-bottom: 20px;
}

.job-meta dt {
  color: var(--text-dim);
  font-weight: 500;
}

.job-meta dd {
  color: var(--text);
  word-break: break-all;
}

.status-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Artifacts ────────────────────────────────────────────────────── */
.artifacts-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
}

.artifacts-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
}

.artifact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.artifact-item {
  padding: 6px 0;
}

.artifact-link {
  color: var(--text);
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: inline-block;
  text-decoration: none;
}

.artifact-link:hover {
  background: var(--bg-hover);
  text-decoration: none;
}

.artifact-pdf { border-color: #dc2626; color: #fca5a5; }
.artifact-pdf:hover { background: #dc2626; color: #fff; }

.artifact-md { border-color: #10b981; color: #6ee7b7; }
.artifact-md:hover { background: #10b981; color: #111827; }

.artifact-missing {
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Submit form ──────────────────────────────────────────────────── */
.submit-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 600px;
}

.submit-intro {
  margin-bottom: 20px;
  color: var(--text-dim);
  font-size: 14px;
}

.submit-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.url-input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.url-input:focus {
  outline: none;
  border-color: var(--accent);
}

.submit-note {
  color: var(--text-muted);
  font-size: 12px;
}

/* ── Onboarding ────────────────────────────────────────────────────── */
.onboarding-shell,
.confirm-layout {
  display: grid;
  gap: 16px;
  max-width: 760px;
}

.onboarding-card,
.confirm-card {
  width: 100%;
}

.onboarding-card h2,
.confirm-card h2 {
  font-size: 16px;
  margin-bottom: 8px;
}

.resume-input {
  width: 100%;
  min-height: 260px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  resize: vertical;
}

.resume-input:focus,
.profile-grid input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-actions {
  margin-top: 16px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px 14px;
  align-items: center;
}

.profile-grid label {
  color: var(--text-dim);
  font-size: 13px;
}

.profile-grid input {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

.profile-grid input:disabled {
  color: var(--text-dim);
}

.file-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-dim);
  font-size: 13px;
}

input[type="file"] {
  display: block;
  width: 100%;
  margin-bottom: 12px;
  color: var(--text);
}

.admin-banner {
  border-left: 3px solid var(--accent);
}

.content:has(.admin-shell) {
  max-width: 1400px;
}

.admin-shell {
  max-width: 1220px;
}

.admin-shell .submit-card {
  max-width: none;
}

.admin-users-card {
  overflow: hidden;
}

.admin-users-scroll {
  overflow-x: auto;
  margin: 0 -8px;
  padding: 0 8px;
}

.admin-banner-success {
  border-left-color: var(--accent);
}

.admin-banner-error {
  border-left-color: #c0392b;
}

.admin-banner-title {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.admin-banner-value {
  display: block;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: ui-monospace, monospace;
  font-size: 13px;
  word-break: break-all;
}

.admin-banner-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.admin-users {
  width: 100%;
  min-width: 1060px;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-users th,
.admin-users td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.admin-users th {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-dim {
  color: var(--text-dim);
  font-size: 12px;
}

.admin-reason {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-actions form {
  margin: 0;
}

.btn-small {
  padding: 4px 10px;
  font-size: 12px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.badge-new        { color: #d4a017; border-color: #d4a017; }
.badge-confirming { color: #2e86c1; border-color: #2e86c1; }
.badge-active     { color: #229954; border-color: #229954; }
.badge-running    { color: var(--accent); border-color: var(--accent); }

.badge-tg-linked  { color: #229954; border-color: #229954; }
.badge-tg-none    { color: var(--text-dim); }
.badge-tg-chat_id_zero { color: #c0392b; border-color: #c0392b; }

.badge-run-completed { color: #229954; border-color: #229954; }
.badge-run-running   { color: var(--accent); border-color: var(--accent); }
.badge-run-failed    { color: #c0392b; border-color: #c0392b; }

.dropzone {
  position: relative;
  margin-bottom: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 120ms ease, background 120ms ease;
}

.dropzone.is-dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--accent);
}

.dropzone [data-dropzone-input] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px 12px;
  text-align: center;
  pointer-events: none;
}

.dropzone-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.dropzone-sub {
  color: var(--text-dim);
  font-size: 12px;
}

.progress-list {
  display: grid;
  gap: 8px;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 13px;
}

.progress-item.done {
  color: var(--text);
}

.progress-mark {
  width: 18px;
  color: var(--accent);
}

.link-code {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.resume-preview {
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--text-dim);
}

@media (max-width: 700px) {
  .profile-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* ── Misc ─────────────────────────────────────────────────────────── */
code, pre {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  font-size: 13px;
}
