

:root {
  --green: #0B5D43;
  --green-deep: #06352A;
  --leaf: #E7F3EE;
  --saffron: #F2A900;
  --saffron-tint: #FDF1D2;
  --ink: #10201A;
  --ink-2: #3C4A44;
  --muted: #55635D;
  --line: #E3E8E5;
  --line-strong: #CBD3CF;
  --mist: #F4F6F5;
  --white: #FFFFFF;
  --red: #B42318;
  --red-tint: #FDECEA;
  --blue: #123E6B;
  --blue-tint: #DCEBFA;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Manrope, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background: var(--mist);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
a:hover { color: var(--green-deep); }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: 14px;
  padding: 11px 16px; min-height: 44px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--white); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--mist); color: var(--ink); }
.btn-primary { background: var(--green); border-color: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--green-deep); color: var(--white); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--white); }
.btn-dark:hover { background: #000; color: var(--white); }
.btn-wa { background: #1F8A4C; border-color: #1F8A4C; color: #fff; }
.btn-wa:hover { background: #17703D; color: #fff; }
.btn-danger { color: var(--red); }
.btn-sm { min-height: 36px; padding: 7px 12px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 40px; height: 40px; padding: 0; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.field .hint { font-weight: 500; font-size: 12px; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=url],
input[type=search], input[type=date], input[type=datetime-local], select, textarea {
  font: inherit; font-weight: 500; font-size: 15px; color: var(--ink);
  padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--white); width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 90px; }
input[type=file] { font: inherit; font-size: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: 14px; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spacer { flex: 1; }

/* ---------- Chips ---------- */
.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--mist); color: var(--ink-2); }
.chip-green { background: var(--leaf); color: var(--green-deep); }
.chip-gold { background: var(--saffron-tint); color: #6B4A00; }
.chip-blue { background: var(--blue-tint); color: var(--blue); }
.chip-red { background: var(--red-tint); color: var(--red); }

/* ---------- Cards ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 17px; letter-spacing: -0.3px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--green); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; z-index: 1000; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
#toast.error { background: var(--red); }

/* ---------- Public pages ---------- */
.pub-header { background: var(--white); border-bottom: 1px solid var(--line); }
.pub-wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.pub-header .pub-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.pub-hero { background: var(--white); border-bottom: 1px solid var(--line); padding: 40px 0 32px; }
.pub-hero h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.08; }
.pub-hero p { margin-top: 10px; font-size: 17px; color: var(--ink-2); max-width: 640px; }
.job-list { display: flex; flex-direction: column; gap: 12px; padding: 28px 0 64px; }
.job-card { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.job-card h2 { font-size: 18px; font-weight: 800; }
.job-card .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.job-card .main { flex: 999 1 300px; min-width: 0; }
.apply-layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; padding: 28px 0 64px; }
.apply-layout .job-detail { flex: 1 1 340px; min-width: 0; }
.apply-layout form { flex: 999 1 460px; min-width: 0; }
.pre { white-space: pre-line; }
.success { text-align: center; padding: 48px 24px; }
.success .tick { width: 64px; height: 64px; border-radius: 999px; background: var(--leaf); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }

/* ---------- Admin shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 240px; flex: 0 0 240px; background: var(--white); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .brand { padding: 4px 8px 20px; }
.nav-btn { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; font-weight: 600; font-size: 15px; color: var(--ink-2); background: transparent; border: none; padding: 11px 12px; border-radius: 10px; cursor: pointer; }
.nav-btn:hover { background: var(--mist); }
.nav-btn[aria-current=page] { background: var(--leaf); color: var(--green-deep); font-weight: 800; }
.nav-btn .count { margin-left: auto; font-size: 12px; font-weight: 800; background: var(--saffron); color: var(--ink); padding: 1px 8px; border-radius: 999px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.page-head h1 { font-size: 28px; font-weight: 800; }
.page-head p { color: var(--muted); margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.stat .n { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.stat .l { color: var(--muted); font-size: 14px; font-weight: 600; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 10px; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 999 1 240px; }
.toolbar select { flex: 1 1 150px; width: auto; }

.table-wrap { background: var(--white); border: 1px solid var(--line); border-radius: 16px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: #FAFBFA; white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid #EEF1EF; vertical-align: middle; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #F7FBF9; }
.person { display: flex; align-items: center; gap: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-weight: 800; flex: 0 0 auto; background: var(--leaf); color: var(--green-deep); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------- Pipeline ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(180px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #EDF0EE; border-radius: 14px; padding: 10px; min-height: 160px; display: flex; flex-direction: column; gap: 8px; }
.col h3 { font-size: 13px; font-weight: 800; padding: 4px 6px; display: flex; justify-content: space-between; }
.app-card { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.app-card .name { font-weight: 800; cursor: pointer; }
.app-card select { padding: 7px 8px; font-size: 13px; }

/* ---------- Drawer & modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(16,32,26,.45); z-index: 50; display: flex; justify-content: flex-end; }
.drawer { width: min(640px, 100%); height: 100%; background: var(--white); overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.modal-wrap { position: fixed; inset: 0; background: rgba(16,32,26,.45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--white); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-head, .drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head h2, .drawer-head h2 { font-size: 22px; font-weight: 800; }
.section-title { font-size: 14px; font-weight: 800; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kv div { background: var(--white); padding: 10px 12px; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 2px 0 0; font-weight: 700; word-break: break-word; }
.list-item { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid #EEF1EF; }
.stars button { background: none; border: none; font-size: 22px; cursor: pointer; color: #CBD3CF; padding: 0 2px; }
.stars button.on { color: var(--saffron); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login .card { width: min(420px, 100%); padding: 32px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { width: 100%; flex: none; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; gap: 2px; }
  .side .brand { padding: 4px 8px; width: 100%; }
  .nav-btn { width: auto; padding: 9px 10px; font-size: 14px; }
  .main { padding: 18px 14px 48px; }
}
.drawer > *, .modal > * { flex-shrink: 0; }
.main:focus { outline: none; }
@media (max-width: 860px) {
  .side-foot { display: flex; flex-direction: row; margin: 0 0 0 auto; border: none; padding: 0; }
  .side-foot #whoami { display: none; }
}

/* ---------- CV drop zone & auto-fill ---------- */
.dropzone { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 18px; border: 2px dashed var(--line-strong); border-radius: 16px; background: #FAFCFB; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--green); background: var(--leaf); }
.dropzone:focus-within { outline: 3px solid var(--saffron); outline-offset: 2px; }
.dropzone.has-file { border-style: solid; border-color: var(--green); background: var(--leaf); }
.dz-icon { width: 52px; height: 52px; border-radius: 999px; background: var(--white); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.dz-title { font-weight: 800; font-size: 17px; }
.dz-sub { font-size: 13px; color: var(--muted); }
.note { border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 600; background: var(--leaf); color: var(--green-deep); }
.note.warn { background: var(--saffron-tint); color: #6B4A00; }
.autofilled { border-color: var(--green) !important; background: #F7FBF9 !important; }
.why { display: flex; flex-wrap: wrap; gap: 6px; }
.why .chip { font-weight: 600; }

/* ---------- v3: segments, pills, timeline, bars, tasks ---------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.btn[aria-pressed=true] { background: var(--leaf); border-color: var(--green); color: var(--green-deep); }
.pill { cursor: pointer; }
.pill span { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 40px; border: 1px solid var(--line-strong); border-radius: 10px; font-weight: 700; background: var(--white); }
.pill input:checked + span { background: var(--green); border-color: var(--green); color: #fff; }
.pill input:focus-visible + span { outline: 3px solid var(--saffron); outline-offset: 2px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; display: flex; flex-direction: column; gap: 12px; border-left: 2px solid var(--line); }
.timeline li { display: flex; gap: 12px; align-items: flex-start; margin-left: -12px; font-size: 14px; }
.tl-dot { width: 12px; height: 12px; border-radius: 999px; background: var(--white); border: 2px solid var(--green); flex: 0 0 auto; margin-top: 4px; }
.tl-dot.note { background: var(--saffron); border-color: var(--saffron); }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.overdue { color: var(--red); font-weight: 700; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; height: 10px; background: var(--mist); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--green); border-radius: 999px; min-width: 2px; }
.bar-n { font-weight: 800; min-width: 48px; text-align: right; }
code { background: var(--mist); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.role-viewer [data-act=new-job], .role-viewer [data-act=add-cv], .role-viewer [data-act=import-cvs], .role-viewer [data-act=new-client],
.role-viewer [data-act=edit-job], .role-viewer [data-act=schedule], .role-viewer [data-act=delete-cand], .role-viewer [data-act=bulk-email],
.role-viewer [data-act=bulk-email-pool], .role-viewer #candEdit button[type=submit] { display: none !important; }

/* ---------- v4: AI box, share grid ---------- */
.ai-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #FBFCFB; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.share-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px; border: 1px solid var(--line-strong); border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--white); font: inherit; text-align: left; cursor: pointer; min-height: 64px; }
.share-tile:hover { border-color: var(--green); background: var(--leaf); color: var(--ink); }

/* ---------- v5: job types and pool-first ---------- */
.cat-strip { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.cat-strip:empty { display: none; }
.cat-pill { font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line, #DCE3E0); background: #fff; color: var(--ink); cursor: pointer; }
.cat-pill b { font-weight: 800; color: var(--green); margin-left: 4px; }
.cat-pill.on { background: var(--green); border-color: var(--green); color: #fff; }
.cat-pill.on b { color: #fff; }
.cat-pill:disabled { cursor: default; opacity: .8; }
.cat-pill:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
.cat-edit { display: flex; flex-wrap: wrap; gap: 6px; }
.pool-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; padding-right: 4px; }
.pool-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line, #DCE3E0); border-radius: 12px; background: #fff; cursor: pointer; }
.pool-row:has(input:checked) { border-color: var(--green); background: var(--leaf); }
.pool-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); flex-shrink: 0; }
@media (max-width: 640px) {
  .pool-row { flex-wrap: wrap; }
  .pool-row > span:nth-of-type(2) { flex: 1 1 170px !important; }
  .pool-row > .row:last-child { width: 100%; justify-content: flex-end; }
  .pool-list { max-height: 46vh; }
}

/* ---------- OneDrive edition ---------- */
.btn-danger-text { color: var(--red, #B42318); }
.timeline { border-left: 2px solid var(--line); padding-left: 14px; }
.tl-item { display: flex; flex-direction: column; gap: 2px; font-size: 14px; position: relative; }
.tl-item::before { content: ''; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px; border-radius: 999px; background: #fff; border: 2px solid var(--green); }
.imp-log { max-height: 220px; overflow: auto; }
.imp-log:empty { display: none; }
.start-card { width: min(520px, 100%); display: flex; flex-direction: column; gap: 14px; }
.start-card h1 { font-size: 24px; font-weight: 800; }
.sync-note { font-size: 12px; color: var(--muted, #5B6B64); }
body.role-exec [data-manager-only] { display: none !important; }
