:root {
  --brand: #1f5fbf; --brand-ink: #fff; --brand-soft: #e8f0fc;
  --ink: #18212b; --muted: #5b6876; --faint: #8a96a3; --line: #e2e7ed; --line-strong: #cfd7e0;
  --bg: #f4f6f9; --panel: #fff; --hover: #f1f4f8;
  --ok: #1c7c4a; --ok-soft: #e5f5ec; --warn: #9a5b00; --warn-soft: #fff4e0; --bad: #b42318; --bad-soft: #fdecea;
  --radius: 8px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 17px; margin: 0 0 12px; } h3 { font-size: 15px; margin: 0 0 8px; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { resize: vertical; }
label { display: block; font-weight: 600; font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--ink); margin: 6px 12px 6px 0; font-size: 14px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 6px; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); } .btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.sm { padding: 3px 8px; font-size: 12.5px; } .btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* layout */
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.side { background: #142033; color: #c9d4e3; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { color: #fff; font-weight: 800; font-size: 17px; padding: 4px 10px 14px; display: block; }
.side a { display: flex; align-items: center; gap: 8px; color: #c9d4e3; padding: 8px 10px; border-radius: 6px; font-weight: 500; }
.side a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.side a.on { background: rgba(255,255,255,.13); color: #fff; }
.side .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7d8ca0; padding: 14px 10px 4px; }
.side .badge { margin-left: auto; }
.main { min-width: 0; }
.top { display: flex; gap: 12px; align-items: center; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .search { flex: 1; max-width: 640px; position: relative; }
.top .search input { padding-left: 32px; }
.top .search::before { content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-52%); color: var(--faint); font-size: 17px; }
.top .me { margin-left: auto; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.menu-btn { display: none; }
.content { padding: 22px 24px 60px; max-width: 1400px; }
.page-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 3px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.stat { padding: 14px 16px; } .stat .n { font-size: 26px; font-weight: 700; } .stat .l { color: var(--muted); font-size: 12.5px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .right { text-align: right; }
.nowrap { white-space: nowrap; } .ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); padding: 22px; text-align: center; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--hover); }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--hover); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.brand { background: var(--brand-soft); color: var(--brand); }
.chip { display: inline-block; background: var(--brand-soft); color: var(--brand); padding: 1px 8px; border-radius: 4px; margin: 2px 3px 2px 0; font-size: 12px; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 9px 13px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-color: var(--brand); } .tabs a:hover { text-decoration: none; color: var(--ink); }

/* profile */
.profile-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 19px; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.profile-cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }

.feed-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
.note-body { white-space: pre-wrap; word-break: break-word; }
.replies { margin-left: 40px; border-left: 2px solid var(--line); padding-left: 12px; }
.email { border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; }
.email summary { padding: 9px 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; list-style: none; }
.email summary::-webkit-details-marker { display: none; }
.email .body { padding: 10px 14px; border-top: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; background: #fbfcfd; }

.app-row { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; }
.stagebar { display: flex; gap: 2px; margin: 8px 0; }
.stagebar span { flex: 1; height: 6px; background: var(--line); border-radius: 2px; }
.stagebar span.done { background: var(--brand); } .stagebar.rej span.done { background: var(--bad); } .stagebar.hired span.done { background: var(--ok); }

/* kanban */
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.col { background: #eaeef3; border-radius: var(--radius); min-width: 230px; width: 230px; flex: none; display: flex; flex-direction: column; max-height: 75vh; }
.col h4 { margin: 0; padding: 10px 12px; font-size: 13px; display: flex; justify-content: space-between; }
.col .cards { padding: 0 8px 8px; overflow-y: auto; min-height: 50px; }
.col.drag { outline: 2px dashed var(--brand); }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-bottom: 7px; cursor: grab; box-shadow: var(--shadow); }
.kcard .nm { font-weight: 600; } .kcard .acts { display: flex; gap: 4px; margin-top: 6px; }
.kcard.rej { opacity: .55; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,35,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { max-width: 900px; }
.modal header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal header h2 { margin: 0; }
.modal .body { padding: 6px 18px 16px; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: #fff; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; } .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 99; }
#toast div { background: #1d2733; color: #fff; padding: 10px 16px; border-radius: 8px; margin-top: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
#toast div.err { background: var(--bad); }

.drop { border: 2px dashed var(--line-strong); border-radius: 10px; padding: 34px; text-align: center; color: var(--muted); background: #fff; cursor: pointer; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.notice { padding: 10px 14px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); margin-bottom: 14px; border: 1px solid #f3d9a4; }
.notice.info { background: var(--brand-soft); color: #194a94; border-color: #c4d7f5; }
.notice.bad { background: var(--bad-soft); color: var(--bad); border-color: #f5c2bd; }
.help { background: #fbfcfd; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; font-size: 12.5px; color: var(--muted); }
.help code, code { background: var(--hover); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
mark { background: #fff1a8; padding: 0 1px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }
.stars { display: inline-flex; gap: 3px; } .stars button { border: 1px solid var(--line-strong); background: #fff; border-radius: 4px; width: 30px; height: 28px; cursor: pointer; font-weight: 600; }
.stars button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.crit { padding: 10px 0; border-bottom: 1px solid var(--line); }
.login { max-width: 360px; margin: 12vh auto; }
.day-head { font-weight: 700; margin: 16px 0 6px; color: var(--muted); }
.merge-table td:first-child { color: var(--muted); width: 140px; }
.merge-table label.inline { margin: 0; }

@media (max-width: 1000px) { .profile-cols { grid-template-columns: 1fr; } .g4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: -240px; width: 230px; z-index: 40; transition: left .2s; }
  .side.open { left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px; } .top { padding: 10px 16px; }
  .g2, .g3, .row2, .row3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; } .top .me span { display: none; }
}

/* additional features */
.bell { position: relative; font-size: 15px; }
.bell .count { position: absolute; top: -6px; right: -6px; background: var(--bad); color: #fff; border-radius: 999px; font-size: 10.5px; min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; font-weight: 700; }
.bell .count[hidden] { display: none; }
.warn-text { color: var(--warn); font-weight: 600; }
.bad-text { color: var(--bad); font-weight: 600; }
select.mini { width: auto; padding: 2px 6px; font-size: 12px; }
.feed-item.unread { background: var(--brand-soft); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.miss { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; }
.match-head { display: flex; gap: 14px; align-items: center; margin-top: 8px; }
.match-head .score { font-size: 28px; font-weight: 800; width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; border: 6px solid var(--line); }
.match-head .score.strong { border-color: var(--ok); color: var(--ok); }
.match-head .score.moderate { border-color: #e0a100; color: var(--warn); }
.match-head .score.weak { border-color: var(--bad); color: var(--bad); }
.bar { display: inline-block; width: 70px; height: 7px; background: var(--line); border-radius: 4px; vertical-align: middle; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); }
.kcard .flag { font-size: 11px; margin-top: 3px; }
th a { color: inherit; }
.grid > .card + .card { margin-top: 0; }
.modal .body h3 { margin-top: 14px; }

/* rich text editor (job descriptions) */
.rte { border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; }
.rte:focus-within { border-color: var(--brand); outline: 2px solid var(--brand-soft); }
.rte-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; border-bottom: 1px solid var(--line); background: #fafbfc; border-radius: 6px 6px 0 0; position: sticky; top: 0; z-index: 1; }
.rte-bar button { border: 1px solid transparent; background: transparent; border-radius: 4px; padding: 3px 8px; cursor: pointer; font-size: 13px; }
.rte-bar button:hover { background: var(--hover); border-color: var(--line); }
.rte-bar select { width: auto; padding: 3px 6px; font-size: 13px; }
.rte-sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 2px; }
.rte-area { min-height: 200px; max-height: 480px; overflow-y: auto; padding: 10px 12px; outline: none; line-height: 1.5; }
.jd h2 { font-size: 1.3em; margin: 1em 0 .4em; } .jd h3 { font-size: 1.12em; margin: .9em 0 .35em; } .jd h4 { font-size: 1em; margin: .8em 0 .3em; }
.jd p { margin: 0 0 .8em; } .jd ul, .jd ol { margin: 0 0 .8em; padding-left: 1.6em; } .jd blockquote { margin: 0 0 .8em 2em; }
.jd > :first-child { margin-top: 0; }

/* question builder (application forms, knockout questions) */
.qb-row { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; background: #fff; }
.qb-row.std { align-items: center; background: #fafbfc; } .qb-row.off { opacity: .6; }
.qb-row .qb-main { flex: 1; min-width: 0; } .qb-row .qb-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.qb-move { display: flex; flex-direction: column; } .qb-move .btn { padding: 0 6px; }
.qb-ko { margin-top: 8px; padding: 8px; background: var(--warn-soft); border-radius: 6px; }
.qb-empty { padding: 6px 0 10px; }
.preview-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-top: 10px; }

/* tasks: filters and bulk actions */
.filters-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 10px; }
.filters-bar > div { min-width: 140px; } .filters-bar label { margin-top: 0; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.bulk-bar.on { border-color: var(--brand); background: var(--brand-soft); position: sticky; top: 56px; z-index: 4; }
.bulk-bar .sep { width: 1px; height: 20px; background: var(--line-strong); } .bulk-bar .mini { width: auto; }
tr.sel td { background: var(--brand-soft); }

/* email previews and token issues */
.token-pick { width: auto; max-width: 260px; }
.email-preview { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; background: #fff; }
.ep-subject { font-weight: 700; margin-bottom: 10px; } .ep-body { white-space: pre-wrap; }
mark.tok-miss { background: var(--bad-soft); color: var(--bad); border-radius: 3px; padding: 0 2px; }
.rv-hist { margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--line); }
[hidden] { display: none !important; }
