:root {
  --bg: #f3f5fb;
  --bg-glow-1: rgb(99 102 241 / 14%);
  --bg-glow-2: rgb(14 165 233 / 12%);
  --surface: rgb(255 255 255 / 86%);
  --surface-solid: #ffffff;
  --text: #151a2c;
  --muted: #62697d;
  --border: rgb(21 26 44 / 10%);
  --field: #f7f8fc;
  --accent: #5b5bf0;
  --accent-2: #2f8ef5;
  --accent-grad: linear-gradient(135deg, #6a5cf5 0%, #3f8cf7 100%);
  --accent-text: #ffffff;
  --accent-soft: rgb(91 91 240 / 10%);
  --ok: #12703a;
  --ok-soft: #dff5e8;
  --warn: #8a5a00;
  --warn-soft: #fff0cf;
  --bad: #b3261e;
  --bad-soft: #fde5e4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(21 26 44 / 5%), 0 10px 30px -8px rgb(40 50 120 / 16%);
  --shadow-btn: 0 1px 2px rgb(21 26 44 / 10%), 0 6px 16px -4px rgb(91 91 240 / 45%);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1020;
    --bg-glow-1: rgb(99 102 241 / 22%);
    --bg-glow-2: rgb(14 165 233 / 14%);
    --surface: rgb(26 31 52 / 78%);
    --surface-solid: #1a1f34;
    --text: #e9ecf6;
    --muted: #98a1b8;
    --border: rgb(255 255 255 / 9%);
    --field: rgb(255 255 255 / 5%);
    --accent: #8b8bff;
    --accent-soft: rgb(139 139 255 / 14%);
    --ok: #64d996;
    --ok-soft: rgb(100 217 150 / 14%);
    --warn: #f3c46a;
    --warn-soft: rgb(243 196 106 / 14%);
    --bad: #ff8a85;
    --bad-soft: rgb(255 138 133 / 14%);
    --shadow: 0 1px 0 rgb(255 255 255 / 4%) inset, 0 12px 32px -10px rgb(0 0 0 / 55%);
    --shadow-btn: 0 6px 18px -4px rgb(91 91 240 / 55%);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 8% -8%, var(--bg-glow-1), transparent 70%),
    radial-gradient(800px 400px at 100% 0%, var(--bg-glow-2), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
h3 { font-size: 1rem; margin-top: 1.25rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.boot { padding: 2rem 16px; text-align: center; color: var(--muted); }

/* ---- Login ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 36px 30px;
  text-align: center;
}
.login-card h1 { font-size: 1.6rem; }
.login-card .lead { color: var(--muted); margin-bottom: 1.5rem; }
.btn-ms {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px 16px;
  font: inherit; font-weight: 600; color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 1px 2px rgb(21 26 44 / 8%);
  cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.btn-ms:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px -6px rgb(21 26 44 / 25%); }
.btn-ms:disabled { opacity: .6; cursor: progress; }
.ms-logo { width: 18px; height: 18px; flex: none; }

/* ---- App shell ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, calc((100% - 1040px) / 2));
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.topbar .brand-logo { width: 30px; height: 30px; object-fit: contain; flex: none; }
.topbar .who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .9rem; }

main { max-width: 1040px; margin: 0 auto; padding: 28px 16px 56px; display: grid; gap: 18px; }

.hero { padding: 8px 2px 4px; }
.hero h1 {
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.hero p { color: var(--muted); max-width: 60ch; margin: 0; }

.card {
  background: var(--surface);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }

.step {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: .8rem; font-weight: 700; color: var(--accent-text);
  background: var(--accent-grad);
  box-shadow: var(--shadow-btn);
}

.grid-2 { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }
@media (max-width: 680px) { .grid-2 { grid-template-columns: 1fr; } }

label, .label { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.field { margin-bottom: 16px; }

input[type="file"] { display: none; }
.picker {
  display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center;
  padding: 12px; background: var(--field);
  border: 1.5px dashed var(--border); border-radius: 12px;
  transition: border-color .15s, background .15s;
}
.picker:hover { border-color: var(--accent); background: var(--accent-soft); }
.picked { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }

textarea {
  width: 100%; min-height: 96px; padding: 10px 12px;
  font: inherit; color: var(--text); background: var(--field);
  border: 1px solid var(--border); border-radius: 12px; resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type="range"] { width: 100%; accent-color: var(--accent); }

.btn {
  font: inherit; font-weight: 600; font-size: .9rem;
  padding: 8px 14px; color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 1px 2px rgb(21 26 44 / 6%);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s, filter .15s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); background: var(--accent-soft); box-shadow: 0 6px 14px -6px rgb(21 26 44 / 25%); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  color: var(--accent-text);
  background: var(--accent-grad);
  border-color: transparent;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-grad); filter: brightness(1.07); box-shadow: var(--shadow-btn); }
.btn-block { width: 100%; padding: 13px 16px; font-size: 1rem; border-radius: 12px; }
.btn-sm { padding: 5px 11px; font-size: .82rem; border-radius: 8px; }
.btn-ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--accent); }
.btn-link { border: 0; background: none; color: var(--accent); padding: 4px 6px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 10px; }

/* ---- Progress ---- */
.progress { height: 12px; background: var(--field); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.progress > span {
  display: block; height: 100%; width: 0;
  background: var(--accent-grad);
  background-size: 200% 100%;
  border-radius: 99px;
  transition: width .25s ease;
  animation: shimmer 2.2s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .progress > span { animation: none; } }
.status { margin: 8px 0 0; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.log {
  max-height: 220px; overflow: auto; margin: 8px 0 0; padding: 12px;
  font: .8rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--field); border: 1px solid var(--border); border-radius: 12px; white-space: pre-wrap;
}

.notice { padding: 10px 14px; border-radius: 12px; margin: 0 0 12px; }
.notice.error { background: var(--bad-soft); color: var(--bad); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }

/* ---- Nav / page chrome ---- */
.topbar .brand { color: var(--text); text-decoration: none; }
.nav { display: flex; gap: 4px; margin-right: auto; margin-left: 18px; }
.nav-link { padding: 6px 12px; border-radius: 99px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; transition: background .15s, color .15s; }
.nav-link:hover { background: var(--accent-soft); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 640px) { .nav { margin-left: 0; } .topbar .who span, .topbar .who { font-size: .8rem; } }

.back { display: inline-block; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.back:hover { color: var(--accent); }
.page-head h1 { font-size: 1.6rem; margin: 0; }

a.btn { display: inline-block; text-decoration: none; }
.btn-lg { padding: 13px 24px; font-size: 1rem; border-radius: 12px; white-space: nowrap; }

/* ---- Home call-to-action ---- */
.cta {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 30px 28px;
  background:
    radial-gradient(600px 220px at 100% 0%, rgb(106 92 245 / 18%), transparent 70%),
    var(--surface);
}
.cta h1 {
  font-size: clamp(1.5rem, 3.2vw, 2rem); margin-bottom: 6px;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cta p { color: var(--muted); margin: 0; max-width: 52ch; }

/* ---- Results ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 10px 0 20px; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px 14px 20px; overflow: hidden;
  background: var(--field); border: 1px solid var(--border); border-radius: 14px;
}
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent-grad); }
.tile.ok::before { background: var(--ok); }
.tile.warn::before { background: var(--warn); }
.tile.bad::before { background: var(--bad); }
.tile strong { font-size: 1.7rem; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile small { color: var(--muted); font-size: .8rem; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-bottom: 12px; }
.search {
  flex: 1 1 220px; max-width: 320px; padding: 8px 12px; font: inherit;
  color: var(--text); background: var(--field); border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.filters { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.filters .label { margin: 0; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.check { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; margin: 0; text-transform: capitalize; cursor: pointer; }
.check input { accent-color: var(--accent); }

/* Shared data-table look */
.table-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-solid); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
table.data th, table.data td { padding: 12px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--accent-soft); }
table.data th {
  position: sticky; top: 0; z-index: 1;
  background: var(--field); backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--border);
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap;
}
table.data .num { text-align: center; }
.nowrap { white-space: nowrap; }
.cell-title { font-weight: 600; overflow-wrap: anywhere; }
.cell-sub { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.empty-cell { text-align: center; color: var(--muted); padding: 28px; }

table.results { table-layout: fixed; min-width: 760px; }
.c-rank { width: 56px; } .c-name { width: 24%; } .c-score { width: 150px; } .c-fit { width: 130px; }
td.rank { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }

.scorebar { display: flex; align-items: center; gap: 10px; }
.meter { flex: 1; height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; min-width: 40px; }
.meter > span { display: block; height: 100%; border-radius: 99px; }
.meter > .hi { background: var(--ok); } .meter > .mid { background: var(--warn); } .meter > .lo { background: var(--bad); }
.score {
  display: inline-block; min-width: 2.8rem; padding: 2px 9px;
  border-radius: 99px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center;
}
.score.hi { background: var(--ok-soft); color: var(--ok); }
.score.mid { background: var(--warn-soft); color: var(--warn); }
.score.lo { background: var(--bad-soft); color: var(--bad); }

.fit { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; text-transform: capitalize; background: var(--ok-soft); color: var(--ok); }
.fit-overqualified, .fit-underqualified { background: var(--warn-soft); color: var(--warn); }

.comments { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: .86rem; line-height: 1.45; }
.comments b { color: var(--muted); font-weight: 600; }

.chip { display: inline-block; margin: 4px 4px 0 0; padding: 1px 10px; border-radius: 99px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 0; flex-wrap: wrap; }
.downloads, .row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.footer-actions { margin-top: 18px; }
.empty { color: var(--muted); margin: 6px 0 0; }
table.jobs td { vertical-align: middle; }
table.jobs .row-actions { flex-wrap: nowrap; }
.history { display: grid; gap: 10px; }


/* ---- Aligned buttons, danger action, info notice ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; line-height: 1.2; white-space: nowrap; }
a.btn { display: inline-flex; }
.row-actions { align-items: center; }
table.jobs .row-actions .btn { min-width: 64px; }
table.jobs td:last-child { white-space: nowrap; }
.btn-danger { color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad-soft); }
.notice.info { background: var(--accent-soft); color: var(--text); }

/* ---- Loaders ---- */
[hidden] { display: none !important; }
.spinner {
  display: inline-block; width: 16px; height: 16px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  color: var(--accent); animation: spin .7s linear infinite; vertical-align: -3px;
}
.spinner.lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner, .btn.loading::before { animation-duration: 2s; } }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 36px 12px; color: var(--muted); }

/* Button spinner: keeps the label, adds a spinner in front. */
.btn.loading { pointer-events: none; opacity: .85; }
.btn.loading::before {
  content: ""; width: 13px; height: 13px; margin-right: 8px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-primary.loading { opacity: .9; }

/* ---- Creator line ---- */
.meta-line { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0; color: var(--muted); font-size: .88rem; }
.meta-line b { color: var(--text); font-weight: 600; }

/* ---- Jobs table (responsive) ---- */
.table-wrap.flat { overflow: visible; max-height: none; }
table.jobs { table-layout: auto; width: 100%; }
table.jobs th, table.jobs td { padding: 12px 10px; vertical-align: middle; text-align: left; }
table.jobs th:first-child, table.jobs td:first-child { padding-left: 16px; }
table.jobs th:last-child, table.jobs td:last-child { padding-right: 16px; }
table.jobs col.j-job { width: 24%; } table.jobs col.j-by { width: 13%; } table.jobs col.j-date { width: 13%; }
table.jobs col.j-count { width: 11%; } table.jobs col.j-status { width: 10%; } table.jobs col.j-exp { width: 11%; }
table.jobs col.j-act { width: 230px; }
table.jobs td.c-actions { white-space: nowrap; }
table.jobs .chip { margin: 0; }
.row-actions { display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 6px; }
table.jobs .row-actions .btn { min-width: 0; }

.menu { position: relative; display: inline-block; }
.menu-list {
  position: absolute; z-index: 5; top: calc(100% + 6px); right: 0; min-width: 170px; padding: 6px;
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 34px -10px rgb(21 26 44 / 35%);
}
.menu-item {
  display: block; width: 100%; padding: 8px 10px; font: inherit; font-size: .88rem; text-align: left;
  color: var(--text); background: none; border: 0; border-radius: 8px; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--accent-soft); outline: none; }

/* Narrow screens: each job becomes a card. */
@media (max-width: 1020px) {
  .table-wrap.flat { border: 0; background: none; }
  table.jobs, table.jobs tbody, table.jobs tr, table.jobs td { display: block; }
  table.jobs colgroup, table.jobs thead { display: none; }
  table.jobs tbody { display: grid; gap: 12px; }
  table.jobs tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding: 16px;
    background: var(--field); border: 1px solid var(--border); border-radius: 14px;
  }
  table.jobs tbody tr:hover { background: var(--field); }
  table.jobs th, table.jobs td, table.jobs th:first-child, table.jobs td:first-child, table.jobs td:last-child { padding: 0; border: 0; }
  table.jobs td::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  }
  table.jobs td.c-job, table.jobs td.c-actions { grid-column: 1 / -1; }
  table.jobs td.c-job::before, table.jobs td.c-actions::before { display: none; }
  table.jobs td.c-job .cell-title { font-size: 1.02rem; }
  table.jobs .row-actions { flex-wrap: wrap; }
  .menu-list { right: auto; left: 0; }
}
@media (max-width: 480px) {
  table.jobs tr { grid-template-columns: 1fr; }
  .cta { padding: 22px 18px; }
  .cta .btn-lg { width: 100%; text-align: center; justify-content: center; }
  .card { padding: 16px; }
}

.login-logo { width: 64px; height: 64px; object-fit: contain; margin: 0 auto 12px; display: block; }
