/* Job Board & Applicant Tracker — HireFlow. Namespaced .jb */
* { box-sizing: border-box; }
body { margin: 0; }
.jb {
    --bg: #f5f7fb; --panel: #ffffff; --panel2: #f3f6fb; --line: #e3e9f2; --ink: #0f172a; --muted: #64748b;
    --brand: #2563eb; --brand-ink: #1d4ed8; --accent: #7c3aed;
    --ok: #16a34a; --warn: #d97706; --danger: #dc2626;
    --shadow: 0 12px 32px -18px rgba(37,99,235,.28);
    min-height: calc(100vh - 44px);
    font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
    background: radial-gradient(1000px 420px at 90% -10%, rgba(37,99,235,.06), transparent), var(--bg);
    color: var(--ink);
}
.jb-btn { border: 0; cursor: pointer; border-radius: .6rem; padding: .6rem 1rem; font: 700 .86rem inherit; background: var(--brand); color: #fff; transition: transform .1s; white-space: nowrap; }
.jb-btn:hover { transform: translateY(-1px); }
.jb-btn.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.jb-btn.ghost:hover { border-color: var(--brand); }
.jb-btn.sm { padding: .4rem .75rem; font-size: .8rem; }
.jb-btn.danger { background: var(--danger); }
.jb-btn:disabled { opacity: .4; cursor: not-allowed; }
.jb-h2 { margin: 0; font-size: 1.25rem; }

.jb-topbar { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.5rem; background: var(--panel); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; flex-wrap: wrap; }
.jb-brand { display: flex; align-items: center; gap: .6rem; }
.jb-logo { font-size: 1.6rem; }
.jb-brand b { display: block; font-size: 1.05rem; }
.jb-brand small { color: var(--muted); font-size: .72rem; }
.jb-nav { display: flex; gap: .25rem; margin: 0 auto; flex-wrap: wrap; }
.jb-navbtn { border: 0; background: transparent; color: var(--muted); padding: .5rem .8rem; border-radius: .6rem; font: 600 .85rem inherit; cursor: pointer; }
.jb-navbtn:hover { color: var(--ink); background: var(--panel2); }
.jb-navbtn.active { background: var(--brand); color: #fff; }
.jb-top-actions { display: flex; align-items: center; gap: .6rem; }
.jb-live-dot { color: var(--ok); font-size: .72rem; font-weight: 800; letter-spacing: .1em; display: inline-flex; align-items: center; gap: .4rem; }
.jb-live-dot::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--ok); animation: jbpulse 1.3s infinite; }
@keyframes jbpulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.jb-view { max-width: 1360px; margin: 0 auto; padding: 1.5rem; }
.jb-view[hidden] { display: none !important; }
.jb-card { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.3rem; box-shadow: var(--shadow); }
.jb-card h3 { margin: 0 0 1rem; font-size: .95rem; }

/* JOBS */
.jb-jobs-grid { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 800px) { .jb-jobs-grid { grid-template-columns: 1fr; } }
.jb-filters { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.1rem; box-shadow: var(--shadow); position: sticky; top: 76px; }
@media (max-width: 800px) { .jb-filters { position: static; } }
.jb-fgroup { margin-bottom: 1rem; }
.jb-fgroup > b { display: block; font-size: .72rem; text-transform: uppercase; color: var(--muted); font-weight: 800; margin-bottom: .4rem; }
.jb-fgroup label { display: flex; align-items: center; gap: .4rem; font-size: .82rem; padding: .2rem 0; color: var(--muted); cursor: pointer; }
.jb-fgroup label input { accent-color: var(--brand); }
.jb-jobs-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.jb-jobs { display: flex; flex-direction: column; gap: 1rem; }
.jb-job { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.3rem; box-shadow: var(--shadow); cursor: pointer; transition: transform .1s, border-color .15s; }
.jb-job:hover { transform: translateY(-2px); border-color: var(--brand); }
.jb-job .jh { display: flex; align-items: flex-start; gap: .8rem; }
.jb-job .logo { width: 2.6rem; height: 2.6rem; border-radius: .6rem; display: grid; place-items: center; color: #fff; font-weight: 800; flex: none; }
.jb-job h3 { margin: 0; font-size: 1.05rem; }
.jb-job .jm { color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.jb-job .jtags { display: flex; gap: .4rem; flex-wrap: wrap; margin: .6rem 0; }
.jb-job .jtag { font-size: .72rem; background: var(--panel2); color: var(--muted); border-radius: 999px; padding: .15rem .55rem; }
.jb-job .jdesc { font-size: .84rem; color: var(--muted); line-height: 1.5; }
.jb-job .jfoot { display: flex; justify-content: space-between; align-items: center; margin-top: .8rem; font-size: .8rem; color: var(--muted); }
.jb-job .jfoot .sal { font-weight: 700; color: var(--ink); }
.jb-job .apply-count { color: var(--brand-ink); font-weight: 600; }

/* PIPELINE / KANBAN */
.jb-pipe-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.jb-pipe-head select { font: inherit; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--panel); margin-top: .4rem; }
.jb-pipe-stats { display: flex; gap: 1.5rem; }
.jb-pipe-stats .s b { font-size: 1.3rem; font-weight: 800; display: block; }
.jb-pipe-stats .s small { color: var(--muted); font-size: .72rem; }
.jb-kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: .8rem; overflow-x: auto; }
@media (max-width: 1100px) { .jb-kanban { grid-template-columns: repeat(3, minmax(200px,1fr)); } }
@media (max-width: 620px) { .jb-kanban { grid-template-columns: repeat(2, minmax(180px,1fr)); } }
.jb-col { background: var(--panel2); border: 1px solid var(--line); border-radius: .9rem; padding: .7rem; min-height: 320px; }
.jb-col h3 { margin: 0 0 .7rem; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: flex; justify-content: space-between; }
.jb-col h3 span { background: var(--panel); border-radius: 999px; padding: 0 .5rem; }
.jb-cand { background: var(--panel); border: 1px solid var(--line); border-radius: .7rem; padding: .7rem; margin-bottom: .5rem; cursor: pointer; }
.jb-cand:hover { border-color: var(--brand); }
.jb-cand.new { animation: jbin .3s ease; border-color: var(--brand); }
@keyframes jbin { from { opacity: 0; transform: translateY(-6px); } }
.jb-cand .ct { display: flex; align-items: center; gap: .5rem; }
.jb-cand .av { width: 1.9rem; height: 1.9rem; border-radius: 50%; background: #dbeafe; display: grid; place-items: center; font-size: .6rem; font-weight: 800; }
.jb-cand b { font-size: .84rem; }
.jb-cand .cm { color: var(--muted); font-size: .72rem; margin-top: .3rem; }
.jb-cand .cmatch { display: inline-block; font-size: .66rem; font-weight: 800; padding: .05rem .35rem; border-radius: 999px; margin-top: .35rem; }
.jb-cand .cmatch.hi { background: #dcfce7; color: var(--ok); }
.jb-cand .cmatch.md { background: #fef9c3; color: var(--warn); }
.jb-cand .cmatch.lo { background: #fee2e2; color: var(--danger); }
.jb-cand .stars { color: var(--warn); font-size: .74rem; margin-top: .2rem; }
.jb-cand .adv { width: 100%; margin-top: .5rem; border: 1px solid var(--line); background: var(--panel2); color: var(--brand-ink); border-radius: .4rem; padding: .3rem; font: 700 .72rem inherit; cursor: pointer; }
.jb-cand .adv:hover { background: var(--brand); color: #fff; }

/* CANDIDATE DETAIL */
.jb-cd-back { border: 0; background: transparent; color: var(--brand-ink); font: 600 .85rem inherit; cursor: pointer; margin-bottom: 1rem; }
.jb-cd-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .jb-cd-grid { grid-template-columns: 1fr; } }
.jb-cd-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.jb-cd-head .av { width: 3.2rem; height: 3.2rem; border-radius: 50%; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; display: grid; place-items: center; font-weight: 800; }
.jb-cd-head h2 { margin: 0; font-size: 1.4rem; }
.jb-cd-head .cm { color: var(--muted); font-size: .85rem; }
.jb-cd-head .stage-pill { font-size: .68rem; font-weight: 800; text-transform: uppercase; padding: .15rem .55rem; border-radius: 999px; color: #fff; margin-left: auto; }
.jb-cd-sec { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.3rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.jb-cd-sec h4 { margin: 0 0 .8rem; font-size: .95rem; }
.jb-parsed { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: 1rem; }
.jb-parsed div { background: var(--panel2); border-radius: .5rem; padding: .6rem .8rem; font-size: .84rem; }
.jb-parsed div small { color: var(--muted); display: block; font-size: .68rem; text-transform: uppercase; }
.jb-skills { display: flex; flex-wrap: wrap; gap: .35rem; }
.jb-skill { font-size: .74rem; background: #dbeafe; color: var(--brand-ink); border-radius: 999px; padding: .15rem .55rem; }
.jb-skill.match { background: var(--brand); color: #fff; }
.jb-match-bar { display: flex; align-items: center; gap: .8rem; margin: .8rem 0; }
.jb-match-bar .b { flex: 1; height: 12px; background: var(--line); border-radius: 4px; overflow: hidden; }
.jb-match-bar .b i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--ok)); }
.jb-match-bar b { font-size: 1.1rem; }
.jb-scorecard { display: flex; flex-direction: column; gap: .5rem; }
.jb-sc-row { display: flex; align-items: center; gap: .8rem; font-size: .84rem; }
.jb-sc-row .lbl { flex: 1; }
.jb-sc-row .stars { color: var(--warn); cursor: pointer; letter-spacing: .1em; }
.jb-timeline .te { display: flex; gap: .6rem; font-size: .82rem; padding: .3rem 0; }
.jb-timeline .te .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--brand); margin-top: .35rem; flex: none; }
.jb-timeline .te small { color: var(--muted); margin-left: auto; }
.jb-note-add { display: flex; gap: .5rem; margin-top: .6rem; }
.jb-note-add input { flex: 1; font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: .5rem; }
.jb-cd-side { position: sticky; top: 76px; }
@media (max-width: 900px) { .jb-cd-side { position: static; } }
.jb-cd-actions { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.3rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .5rem; }
.jb-cd-actions .contact { font-size: .82rem; color: var(--muted); margin-bottom: .6rem; }

/* REQS */
.jb-req-table { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; overflow: hidden; box-shadow: var(--shadow); }
.jb-req-row { display: grid; grid-template-columns: 1.6fr 1fr 2.2fr .8fr auto; gap: 1rem; padding: .8rem 1.2rem; border-bottom: 1px solid var(--line); font-size: .84rem; align-items: center; }
.jb-req-row:last-child { border-bottom: 0; }
.jb-req-row.head { font-size: .7rem; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.jb-req-row:not(.head) { cursor: pointer; }
.jb-req-row:not(.head):hover { background: var(--panel2); }
.jb-req-row .mini-funnel { display: flex; gap: 3px; }
.jb-req-row .mini-funnel span { flex: 1; text-align: center; font-size: .68rem; padding: .15rem 0; border-radius: 3px; color: #fff; }
.jb-req-row .aging { font-weight: 700; }
.jb-req-row .aging.old { color: var(--danger); }

/* ANALYTICS */
.jb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.jb-kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.2rem; box-shadow: var(--shadow); }
.jb-kpi b { font-size: 1.7rem; font-weight: 800; display: block; }
.jb-kpi small { color: var(--muted); font-size: .78rem; }
.jb-kpi .delta { color: var(--ok); font-size: .74rem; font-weight: 600; }
.jb-analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .jb-analytics-grid { grid-template-columns: 1fr; } }
.jb-card-wide { grid-column: 1 / -1; }
#jb-appchart { width: 100%; height: 180px; }
#jb-sourcedonut { width: 130px; height: 130px; display: block; margin: 0 auto; }
.jb-donut-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; justify-content: center; font-size: .76rem; color: var(--muted); margin-top: .6rem; }
.jb-donut-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.jb-donut-legend i { width: .7rem; height: .7rem; border-radius: 3px; }
.jb-funnel-row { display: flex; align-items: center; gap: .8rem; padding: .5rem 0; font-size: .84rem; }
.jb-funnel-row .n { width: 5.5rem; color: var(--muted); flex: none; }
.jb-funnel-row .fb { flex: 1; height: 18px; background: var(--line); border-radius: 4px; overflow: hidden; }
.jb-funnel-row .fb i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.jb-funnel-row .v { width: 4rem; text-align: right; font-weight: 700; }

/* MODAL (apply / resume parse) */
.jb-modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 130; padding: 1rem; }
.jb-modal-overlay[hidden] { display: none; }
.jb-modal-card { background: var(--panel); border-radius: 1.1rem; padding: 1.8rem; width: min(30rem, 100%); box-shadow: var(--shadow); position: relative; max-height: 90vh; overflow: auto; }
.jb-modal-card .mclose { position: absolute; top: 1rem; right: 1.2rem; border: 0; background: transparent; font-size: 1.4rem; cursor: pointer; color: var(--muted); }
.jb-modal-card h3 { margin: 0 0 1rem; }
.jb-upload { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1.8rem; border: 2px dashed var(--line); border-radius: .9rem; cursor: pointer; text-align: center; color: var(--muted); transition: border-color .15s; }
.jb-upload:hover { border-color: var(--brand); }
.jb-upload .ic { font-size: 2rem; }
.jb-parse-result { margin-top: 1rem; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: .8rem; padding: 1rem; font-size: .85rem; animation: jbin .3s ease; }
.jb-parse-result h4 { margin: 0 0 .6rem; font-size: .78rem; text-transform: uppercase; color: #0369a1; }
.jb-parse-result .f { display: flex; gap: .6rem; padding: .2rem 0; }
.jb-parse-result .f b { color: var(--muted); min-width: 5.5rem; font-weight: 600; }
.jb-submit { width: 100%; margin-top: 1.2rem; }
.jb-confirm { text-align: center; padding: 1rem 0; }
.jb-confirm .check { width: 3.5rem; height: 3.5rem; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 1.6rem; margin: 0 auto 1rem; }

.jb-toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; padding: .7rem 1.1rem; border-radius: .7rem; font: 700 .88rem inherit; z-index: 200; box-shadow: 0 15px 40px -12px rgba(0,0,0,.4); max-width: 90vw; }
.jb-toast[hidden] { display: none; }

/* ---- Wave: drag-and-drop applicant kanban ---- */
.jb-col { display: flex; flex-direction: column; transition: background .15s, box-shadow .15s; }
.jb-col h3 .cnt { background: var(--panel); border-radius: 999px; padding: 0 .5rem; }
.jb-col-body { display: flex; flex-direction: column; gap: .5rem; flex: 1; min-height: 60px; }
.jb-col.drop { background: color-mix(in srgb, var(--brand, #2563eb) 12%, var(--panel2)); box-shadow: inset 0 0 0 2px var(--brand, #2563eb); }
.jb-col.drop .jb-col-body::after { content: "Drop here"; display: block; text-align: center; color: var(--brand, #2563eb); font-size: .74rem; font-weight: 700; padding: .6rem; border: 1.5px dashed var(--brand, #2563eb); border-radius: .6rem; }
.jb-cand { position: relative; cursor: grab; }
.jb-cand:active { cursor: grabbing; }
.jb-cand .drag-grip { position: absolute; top: .5rem; right: .5rem; color: var(--muted); font-size: .7rem; letter-spacing: -2px; opacity: .5; }
.jb-cand.dragging { opacity: .4; transform: rotate(1.5deg) scale(.98); }
