:root {
  --bg: #0f1115; --panel: #171a21; --panel2: #1d2129;
  --line: #2a2f3a; --text: #e7e9ee; --muted: #c8cdd6; --accent: #4f7cff;
  --accent2: #2d4ed8; --good: #2faa6a; --warn: #d99a2b; --bad: #d65151;
  --chip: #232834;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text);
}
a { color: var(--accent); }
button {
  font: inherit; cursor: pointer; border: 1px solid var(--line);
  background: var(--chip); color: var(--text); border-radius: 7px; padding: 7px 12px;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent2); }
button.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  font: inherit; color: var(--text); background: #11141a;
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; width: 100%;
}
textarea { resize: vertical; }
label.field { display: block; margin: 10px 0; }
label.field > span { display: block; color: var(--accent); margin-bottom: 6px; font-size: 16px; font-weight: 500; letter-spacing: .1px; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: 10px; }
.brand small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.brand-logo { height: 32px; width: auto; display: block; background: #fff; border-radius: 6px; padding: 3px 6px; }
.form-logo { display: block; height: 56px; width: auto; margin: 0 auto 14px; background: #fff; border-radius: 8px; padding: 8px 12px; }
.tabs { display: flex; gap: 6px; }
.tabs button {
  background: var(--chip); border: 1px solid var(--line); color: var(--muted);
  padding: 8px 16px; font-size: 14px; font-weight: 600; border-radius: 8px;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.tabs button:hover { color: var(--text); border-color: var(--accent); }
.tabs button.active {
  color: #fff; background: var(--accent); border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(79,124,255,.35);
}
.spacer { flex: 1; }
.pill { font-size: 14px; color: var(--muted); border: 1px solid var(--line); padding: 4px 9px; border-radius: 999px; }
.pill.on { color: var(--good); border-color: #2c5a44; }
.pill.off { color: var(--warn); border-color: #5a4a2c; }

/* ---- candidates layout ---- */
.split { display: grid; grid-template-columns: var(--split-cols, 1.4fr 6px 1fr); gap: 0; height: calc(100vh - 53px); }
.listcol { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.idline { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 14px; margin: 0 0 14px; }
.pane-resizer {
  cursor: col-resize; background: var(--line);
  transition: background .15s; position: relative; user-select: none;
}
.pane-resizer:hover, .pane-resizer.dragging { background: var(--accent); }
.pane-resizer::after {
  content: ''; position: absolute; top: 0; left: -3px; right: -3px; bottom: 0;
}
.toolbar { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.roletabs { display: flex; gap: 8px; padding: 10px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.roletabs:empty { display: none; }
.roletab {
  background: var(--chip); border: 1px solid var(--line); color: var(--muted);
  padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
  border-radius: 999px; display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.roletab:hover { color: var(--text); border-color: var(--accent); }
.roletab.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(79,124,255,.35);
}
.roletab .rt-count {
  font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: rgba(0,0,0,.25); color: inherit; min-width: 20px; text-align: center;
}
.roletab.active .rt-count { background: rgba(255,255,255,.25); color: #fff; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar .count { color: var(--muted); font-size: 14px; margin-left: auto; }
.tablewrap { overflow: auto; flex: 1; }
#ctable { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 15px; table-layout: fixed; }
#ctable th, #ctable td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#ctable th {
  position: sticky; top: 0; background: var(--panel); color: var(--muted);
  font-weight: 600; z-index: 2; user-select: none;
}
#ctable th .thlabel { cursor: pointer; user-select: none; }
#ctable th .thlabel:hover { color: var(--text); }
#ctable th .resizer { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; }
#ctable th .resizer:hover, #ctable th .resizer.dragging { background: var(--accent); opacity: .6; }
/* freeze the first TWO columns (Submitted + Name/Email) on horizontal scroll */
#ctable th:nth-child(-n+2), #ctable td:nth-child(-n+2) { position: sticky; }
#ctable th:nth-child(1), #ctable td:nth-child(1) { left: 0; }
#ctable th:nth-child(2), #ctable td:nth-child(2) { left: var(--col1-width, 80px); border-right: 1px solid var(--line); }
#ctable td:nth-child(-n+2) { background: var(--bg); z-index: 1; }
#ctable th:nth-child(-n+2) { z-index: 3; background: var(--panel); }
#ctable tbody tr:hover td:nth-child(-n+2) { background: #1b1f28; }
#ctable tbody tr.sel td:nth-child(-n+2) { background: #1d2742; }
/* filter row — sticky directly beneath the header row */
#ctable tr.filterrow td {
  position: sticky; top: var(--head-h, 38px); background: var(--panel);
  padding: 4px 6px; z-index: 1; overflow: visible;
}
#ctable tr.filterrow td:nth-child(1), #ctable tr.filterrow td:nth-child(2) { z-index: 2; background: var(--panel); }
.colfilter-btn {
  width: 100%; padding: 4px 8px; font-size: 12px; box-sizing: border-box; cursor: pointer;
  background: #11141a; border: 1px solid var(--line); border-radius: 6px; color: var(--muted);
  text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.colfilter-btn:hover { border-color: var(--accent); color: var(--text); }
.colfilter-btn.active { color: var(--text); border-color: var(--accent); background: #16203a; }
.filterpop {
  position: fixed; z-index: 60; width: 240px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px;
  box-shadow: 0 10px 28px rgba(0,0,0,.5);
}
.filterpop .fp-search {
  width: 100%; padding: 6px 8px; font-size: 13px; box-sizing: border-box;
  background: #11141a; border: 1px solid var(--line); border-radius: 7px; color: var(--text);
}
.filterpop .fp-search:focus { border-color: var(--accent); outline: none; }
.filterpop .fp-actions { display: flex; gap: 12px; padding: 7px 2px 5px; }
.filterpop .fp-actions a { font-size: 12px; }
.filterpop .fp-list { max-height: 240px; overflow: auto; border-top: 1px solid var(--line); padding-top: 4px; }
.filterpop .fp-opt {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px;
  font-size: 13px; cursor: pointer;
}
.filterpop .fp-opt:hover { background: var(--chip); }
.filterpop .fp-opt input { width: 15px; height: 15px; accent-color: var(--accent); flex: none; }
.filterpop .fp-opt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ctable tbody tr { cursor: pointer; }
#ctable tbody tr:hover td { background: #1b1f28; }
#ctable tbody tr.sel td { background: #1d2742; }
/* right-click row colours — win over frozen-column / hover / sel backgrounds */
#ctable tbody tr.clr-red td    { background: #4a2a2e !important; }
#ctable tbody tr.clr-green td  { background: #234034 !important; }
#ctable tbody tr.clr-purple td { background: #362d52 !important; }
#ctable tbody tr.clr-red:hover td    { background: #5a343a !important; }
#ctable tbody tr.clr-green:hover td  { background: #2b4d40 !important; }
#ctable tbody tr.clr-purple:hover td { background: #423866 !important; }

/* context menu */
.ctxmenu {
  position: fixed; z-index: 50; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.45); min-width: 150px;
}
.ctxmenu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: none; color: var(--text); padding: 7px 9px; border-radius: 7px; font-size: 14px;
}
.ctxmenu button:hover { background: var(--chip); }
.ctxmenu .sw { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); flex: none; }
.ctxmenu .sw.clr-red { background: #4a2a2e; }
.ctxmenu .sw.clr-green { background: #234034; }
.ctxmenu .sw.clr-purple { background: #362d52; }
.ctxmenu .sw.none { background: transparent; }
#ctable td.sum { white-space: normal; overflow: visible; text-overflow: clip; vertical-align: top; color: var(--muted); font-size: 14px; line-height: 1.4; }
td.namecell .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
td.namecell .email { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.chk { display: flex; justify-content: center; align-items: center; }
.chk input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
#ctable th[data-key="select"] { text-align: center; padding: 8px 4px; }
#ctable td[data-key="select"] { padding: 4px; }
#rows .rowsel, #ctable .selectall { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* Submitted column: smaller header, slightly larger date content */
#ctable th[data-key="submitted"] .thlabel { font-size: 70%; }
#rows .submitted-date { font-size: 72%; color: var(--muted); white-space: nowrap; }

/* Config sub-tabs */
.subtabs { display: flex; gap: 8px; margin: 0 0 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.subtab {
  background: var(--chip); border: 1px solid var(--line); color: var(--muted);
  padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
  border-radius: 10px;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.subtab:hover { color: var(--text); border-color: var(--accent); }
.subtab.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(79,124,255,.35);
}
.cfgsection { margin: 18px 0 4px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* status board */
#tab-status table th, #tab-status table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
#tab-status table th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
#tab-status .statusrow { cursor: pointer; }
#tab-status .statusrow:hover td { background: #1b1f28; }
#tab-status .name { font-weight: 600; }
#tab-status .email { color: var(--muted); font-size: 13px; }
#tab-status .st-rank { width: auto; padding: 5px 8px; font-size: 13px; }
#tab-status .st-notes { min-width: 150px; width: 100%; padding: 5px 8px; font-size: 13px; }
#tab-status .st-status { min-width: 140px; }

.bulkbar {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 80px);
  display: flex; gap: 12px; align-items: center;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 30; opacity: 0; pointer-events: none;
  transition: transform .2s ease, opacity .2s ease;
}
.bulkbar.shown { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.bulkbar b { color: var(--accent); }
.split.no-pane { grid-template-columns: 1fr; }
body.pane-collapsed .detail { display: none; }
body.pane-collapsed .pane-resizer { display: none; }
body.pane-collapsed .split { grid-template-columns: 1fr !important; }
body.pane-collapsed .pane-resizer { display: none; }
.statussel {
  appearance: none; -webkit-appearance: none;
  border: none; outline: none; cursor: pointer;
  font-size: 13px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; color: #fff;
  width: auto; background: var(--chip);
}
.statussel.new { background: #4a5160; color: #d6dbe6; }
.statussel.invited { background: #2f6fed; }
.statussel.scheduled { background: #c9821f; }
.statussel.case_sent { background: #2faa6a; }
.statussel.case_submitted { background: #0d9488; }
.statussel.interview { background: #8b5cf6; }
.statussel.interview_conducted { background: #4f46e5; }
.statussel.rejected { background: #d24b4b; }

/* ---- status badges (distinct fill per status) ---- */
.badge { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px; color: #fff; white-space: nowrap; }
.badge.new { background: #4a5160; color: #d6dbe6; }
.badge.invited { background: #2f6fed; }
.badge.scheduled { background: #c9821f; }
.badge.case_sent { background: #2faa6a; }
.badge.case_submitted { background: #0d9488; }
.badge.interview { background: #8b5cf6; }
.badge.interview_conducted { background: #4f46e5; }
.badge.rejected { background: #d24b4b; }

/* ---- detail pane ---- */
.detail { overflow: auto; padding: 16px; }
.detail .empty { color: var(--muted); text-align: center; margin-top: 80px; }
.detail h2 { margin: 0 0 2px; }
.detail .sub { color: var(--muted); margin-bottom: 12px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.detail-head-main { min-width: 0; }
.detail-head-rank { flex: 0 0 38%; min-width: 150px; box-sizing: border-box; }
.detail-head-rank .ranksel { width: 100%; max-width: none; box-sizing: border-box; }
.detail-head-rank textarea { width: 100%; box-sizing: border-box; }
.detail-head-rank .hint { text-align: left; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 12px 0; font-size: 15px; }
.kv div.k { color: var(--muted); }
.idkv { grid-template-columns: 90px 1fr; margin: 8px 0 14px; }
.answer { white-space: pre-wrap; font-size: 15px; line-height: 1.55; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 12px 0; background: var(--panel); }
.card h4 { margin: 0 0 8px; font-size: 14px; color: var(--text); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.cvframe { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
/* time-to-submit pill */
.minsfield { display: inline-block; padding: 3px 10px; border-radius: 6px; font-weight: 700; font-size: 14px; }
.minsfield.mins-ok { background: rgba(47,170,106,.20); color: #7ce0a8; }
.minsfield.mins-warn { background: #6b2f33; color: #ffc2c2; }         /* light red — over 90 min */
.minsfield.mins-danger { background: #e02424; color: #fff; animation: flashred 1s ease-in-out infinite; } /* flashy red — over 100 min */
@keyframes flashred {
  0%, 100% { background: #d61f1f; box-shadow: 0 0 0 rgba(255,59,48,0); }
  50%      { background: #ff3b30; box-shadow: 0 0 12px rgba(255,59,48,.8); }
}
.overdue-tag { font-size: 11px; font-weight: 700; color: #cbaaff; margin-top: 3px; white-space: nowrap; }
.hint { color: var(--muted); font-size: 14px; }
.flash { position: fixed; bottom: 18px; right: 18px; background: var(--panel); border: 1px solid var(--accent);
  padding: 10px 14px; border-radius: 10px; z-index: 20; max-width: 360px; }
.flash.err { border-color: var(--bad); }

/* ---- config / centered pages ---- */
.page { max-width: 820px; margin: 0 auto; padding: 24px 18px 60px; }
.page h1 { font-size: 20px; }
.page .muted { color: var(--muted); }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.full { grid-column: 1 / -1; }
.consent { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0 16px; font-size: 14px; line-height: 1.45; cursor: pointer; }
.consent input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--accent); flex: none; cursor: pointer; }
.consent span { color: var(--muted); }
.center-wrap { min-height: 100%; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; }
.cardbox { width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.slotbox { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-top: 14px; }
.slotbox .zone { display: flex; justify-content: space-between; padding: 4px 0; }
.slotbox .zone b { font-weight: 600; }
.ok { color: var(--good); }
.err { color: var(--bad); }
