:root {
  --blue: #0613dd;
  --blue-dark: #040fb0;
  --blue-light: #e9eaf3;
  --blue-mid: #6b6faf;
  --navy: #232870;
  --navy-dark: #111438;
  --portal-bg: #151875;
  --ink: #0d0f2a;
  --ink-soft: #585e64;
  --rule: #e9eaf3;
  --surface: #ffffff;
  --bg: #f8fbfe;
  --ok: #1f7a46;
  --ok-bg: #e7f5ed;
  --err: #b4232c;
  --err-bg: #fdecec;
  --radius: 12px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
main.wrap { flex: 1; padding-top: 36px; padding-bottom: 48px; }

/* Top bar */
.topbar { background: #fff; border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; height: 68px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-badge { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--blue); border-left: 2px solid var(--blue-mid); padding-left: 10px; line-height: 1.3; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.whoami { font-size: 0.82rem; color: var(--ink-soft); }

/* Type */
h1 { font-family: var(--font); font-weight: 800; letter-spacing: -0.01em; font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.2; margin: 0 0 10px; }
h2 { font-family: var(--font); font-weight: 700; font-size: 1.1rem; margin: 0 0 8px; }
h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); margin: 24px 0 8px; }
.eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); margin: 0 0 6px; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; margin-top: 0; }
.loading { color: var(--ink-soft); padding: 40px 0; text-align: center; }

/* Buttons & inputs */
.btn { font: inherit; font-weight: 600; font-size: 0.92rem; padding: 10px 18px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; transition: background .15s, transform .15s; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost { background: var(--surface); border-color: var(--rule); color: var(--ink); }
.btn-ghost:hover { background: var(--blue-light); }
.btn-danger { background: #fff; border-color: var(--err); color: var(--err); }
.btn-danger:hover { background: var(--err-bg); }
.btn-dark { background: #111; color: #fff; border-radius: 6px; padding: 13px 18px; font-size: 1rem; }
.btn-dark:hover { background: #2a2a2a; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.link-btn { background: none; border: none; color: var(--blue); font: inherit; font-size: 0.88rem; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
label { font-size: 0.85rem; font-weight: 600; }
input, select { font: inherit; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, .btn:focus-visible, .link-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
select { width: auto; }

/* Layout */
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .stack { flex: 1 1 200px; }
.row > .stack.narrow { flex: 0 1 120px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 24px; }
.link-btn + .page-head { margin-top: 14px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }

/* Sign in (matches ATS portal) */
body.signin { background: var(--portal-bg); }
body.signin .topbar, body.signin .foot { display: none; }
.foot-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.foot-logo { width: 180px; height: auto; display: block; }
.foot-inner span { text-align: right; line-height: 1.7; }
body.signin main.wrap { display: grid; place-items: center; padding-top: 48px; }
.signin-card { width: 100%; max-width: 440px; margin: 0 auto; background: #fff; border-radius: 4px; padding: 48px 48px 40px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.signin-logo { display: block; height: 52px; width: auto; margin: 0 auto 28px; }
.signin-card h1 { font-size: 1.3rem; font-weight: 600; letter-spacing: 0; margin-bottom: 8px; }
.signin-card > .muted { font-size: 0.92rem; margin: 0; }
.signin-card form { margin: 28px 0 20px; text-align: left; }
.signin-card .notice { text-align: left; }
.trust { margin: 24px 0 18px; padding: 0; list-style: none; font-size: 0.78rem; color: var(--ink-soft); }
.trust li + li { margin-top: 4px; }

/* Notices */
.notice { padding: 12px 14px; border-radius: 8px; font-size: 0.9rem; margin: 12px 0; }
.notice-ok { background: var(--ok-bg); color: var(--ok); }
.notice-err { background: var(--err-bg); color: var(--err); }

/* Status */
.status-pill { display: inline-block; background: var(--blue-light); color: var(--blue); border: 1px solid #d6d8ea; font-size: 0.8rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.badge-new { display: inline-block; background: var(--blue); color: #fff; font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }

/* Dropzone & uploads */
.dropzone { display: block; border: 2px dashed var(--rule); border-radius: var(--radius); padding: 28px 16px; text-align: center; color: var(--ink-soft); font-weight: 400; cursor: pointer; background: var(--bg); transition: border-color .15s, background .15s; margin: 12px 0; }
.dropzone strong { color: var(--blue); }
.dropzone.drag { border-color: var(--blue); background: var(--blue-light); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.uploads { display: flex; flex-direction: column; gap: 6px; }
.upload-row { font-size: 0.85rem; display: grid; grid-template-columns: 1fr 90px; gap: 10px; align-items: center; }
.upload-row .bar { height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.upload-row .bar span { display: block; height: 100%; background: var(--blue); width: 0; transition: width .2s; }
.upload-row.done .bar span { background: var(--ok); }
.upload-row.fail { color: var(--err); }

/* File list */
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); font-size: 0.9rem; }
.file-list li:first-child { border-top: none; }
.file-name { word-break: break-word; }
.file-meta { display: block; font-size: 0.78rem; color: var(--ink-soft); }
.file-actions { display: flex; gap: 6px; flex-shrink: 0; }
.file-actions .btn { padding: 6px 12px; font-size: 0.8rem; }
.empty { color: var(--ink-soft); font-size: 0.88rem; padding: 6px 0; }

/* Checklist */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--rule); font-size: 0.92rem; }
.checklist li:first-child { border-top: none; }
.check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--rule); display: grid; place-items: center; flex-shrink: 0; font-size: 0.7rem; color: #fff; }
.checklist li.done .check { background: var(--ok); border-color: var(--ok); }
.checklist li.done .label { color: var(--ink-soft); text-decoration: line-through; }
.checklist.editable li { cursor: pointer; }
.checklist .label { flex: 1; }
.checklist .remove { background: none; border: none; color: var(--ink-soft); cursor: pointer; font-size: 1rem; }
.inline-add { margin-top: 12px; flex-wrap: nowrap; }

/* Table */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); padding: 0 8px 10px; border-bottom: 1px solid var(--rule); }
.table td { padding: 12px 8px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table .sub { display: block; font-size: 0.78rem; color: var(--ink-soft); }
.add-client { margin-bottom: 20px; }
.add-client .row-actions { margin-top: 16px; }
.danger-zone { border-color: #f1d2d4; }

/* Toast & dialog */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 0.9rem; box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 50; max-width: 90vw; }
dialog { border: none; border-radius: var(--radius); padding: 24px; max-width: 420px; width: calc(100% - 32px); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(29,26,23,0.45); }

.foot { background: var(--navy-dark); color: rgba(255,255,255,0.55); font-size: 0.8rem; padding: 28px 0; }

@media (max-width: 820px) {
  .grid-2 { grid-template-columns: 1fr; }
  .table th:nth-child(2), .table td:nth-child(2) { display: none; }
}
@media (max-width: 520px) {
  .brand-badge { display: none; }
  .whoami { display: none; }
  .signin-card { padding: 36px 22px 28px; }
  .foot-inner span { text-align: left; }
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }
}

/* Upload in progress */
.upload-row.busy .bar span { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* Auth forms */
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.auth-links .link-btn { font-size: 0.82rem; }
.hint { font-size: 0.78rem; color: var(--ink-soft); margin-top: -4px; }
.signin-card label { margin-top: 4px; }
#adminSignInBtn { margin-top: 18px; font-size: 0.8rem; color: var(--ink-soft); }
