:root {
  --bg: #14161f;
  --panel: #1b1e2b;
  --panel-2: #21243333;
  --line: #2b2f42;
  --ink: #e7e9f3;
  --ink-soft: #9aa0bd;
  --accent: #ff9f43;
  --accent-ink: #ffb46a;
  --ok: #3ddc97;
  --danger: #ff6b6b;
  --info: #5aa9ff;
  --radius: 10px;
}

* { box-sizing: border-box; }
*:focus { outline: none; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

h2 { margin: 0; }
a { color: var(--accent-ink); }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #262a3c; border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px; font-size: .9em; color: #ffd9a8;
}
.muted { color: #6d7292; font-size: 13px; }

/* -------- name gate -------- */
.gate { position: fixed; inset: 0; z-index: 80; background: rgba(6,7,12,.75); display: grid; place-items: center; padding: 16px; }
.gate[hidden] { display: none !important; }
.gate-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px 26px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.gate-logo { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; font-weight: 700; background: var(--accent); color: #1a1200; }
.gate-card h1 { font-size: 19px; margin: 0; color: var(--ink); }
.gate-card p { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.gate-card label { display: block; font-size: 12px; color: var(--ink-soft); margin: 14px 0 6px; text-align: left; }
.gate-card input { width: 100%; font: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #11131c; color: var(--ink); }
.gate-note { margin-top: 16px; font-size: 12px; }
.hard-badge { font-size: 10px; vertical-align: middle; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-soft); background: transparent; border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; margin-left: 6px; font-weight: 600; }

/* -------- shell: left rail + content -------- */
.shell { display: flex; min-height: 100vh; }
.rail {
  width: 210px; flex: none; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 10px; gap: 3px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.rail-brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 16px; }
.logo { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; font-size: 14px; font-weight: 700; background: var(--accent); color: #1a1200; flex: none; }
.rail-name { font-size: 14.5px; font-weight: 700; }
.rail-candidate { padding: 10px 8px 4px; margin-top: 6px; border-top: 1px solid var(--line); }
.rail-candidate[hidden] { display: none !important; }
.rail-candidate-label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); }
.rail-candidate-name { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item {
  display: flex; align-items: center; gap: 9px; font: inherit; font-size: 13.5px; text-align: left;
  cursor: pointer; border: none; background: transparent; color: var(--ink-soft);
  padding: 9px 10px; border-radius: 8px;
}
.rail-item:hover { background: #23273a; }
.rail-item.active { border-left: 2px solid var(--accent); }
.ri-ico { font-size: 14px; width: 18px; text-align: center; flex: none; }
.rail-item-text { display: flex; flex-direction: column; line-height: 1.3; gap: 1px; }
.rail-sub { font-size: 10px; color: var(--ink-soft); font-weight: 400; }
.hint-badge { font-size: 10px; background: #3a2c14; color: var(--accent-ink); border-radius: 999px; padding: 1px 6px; margin-left: auto; }
.rail-spacer { flex: 1; }
.token-pill { font-size: 12px; font-weight: 700; color: var(--accent-ink); background: #2a2110; border: 1px solid #4a3a1a; border-radius: 8px; padding: 8px 10px; text-align: center; margin: 6px 4px 0; }
.rail-links { display: flex; gap: 6px; margin-top: 4px; }
.rail-link { flex: 1; font-size: 12px; padding: 6px 10px; text-decoration: none; text-align: center; }

.content { flex: 1; min-width: 0; padding: 22px clamp(14px, 3vw, 34px) 80px; }
.panel { display: none; }
.panel.active { display: block; }
.sec-title { font-size: 15px; margin: 0 0 12px; }
.brief-divider { border: none; border-top: 1px solid var(--line); margin: 30px 0; }
.content p { font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); margin: 8px 0; }
.content p b, .content p i { color: var(--ink); }
.content ul { font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); padding-left: 20px; margin: 6px 0 10px; }
.content li { margin: 3px 0; }

/* -------- jobs toolbar + list -------- */
.page-tagline { font-size: 13px; color: var(--ink-soft); margin: 0 0 14px; }
.toolbar { display: flex; flex-wrap: nowrap; gap: 8px; margin-bottom: 6px; }
.toolbar input, .toolbar select {
  font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel); color: var(--ink); flex: none;
}
.toolbar #search { flex: 1; min-width: 160px; }
.toolbar .chk { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; cursor: pointer; }
.toolbar .chk input { width: 14px; height: 14px; }
.count-line { font-size: 12px; color: #6d7292; margin: 10px 0 12px; }

.joblist { display: flex; flex-direction: column; gap: 8px; }
.job-row {
  display: grid; grid-template-columns: 26px 90px 1fr 180px 90px 110px; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px;
}
.job-row .star { cursor: pointer; font-size: 16px; color: #4a4f6a; user-select: none; }
.job-row .star.on { color: var(--accent); }
.job-row .level-tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent-ink);
  background: #2a2110; border: 1px solid #4a3a1a; border-radius: 4px; padding: 3px 7px; text-align: center;
}
.job-row .job-main .job-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.job-row .job-main .job-sub { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.job-row .salary { font-size: 13px; font-weight: 700; color: var(--accent-ink); text-align: right; }
.job-row .offers { font-size: 11.5px; color: var(--ink-soft); text-align: center; }
.job-row .apply-btn {
  cursor: pointer; background: var(--accent); color: #1a1200; border-radius: 8px; padding: 8px 12px;
  font-size: 12.5px; font-weight: 700; text-align: center;
}
.job-row .apply-btn:hover { background: var(--accent-ink); }
.job-row.closed .apply-btn { background: #3a3d4f; color: var(--ink-soft); pointer-events: none; }

/* -------- drawer (job details) -------- */
.drawer { position: fixed; inset: 0; z-index: 45; background: rgba(6,7,12,.55); display: flex; justify-content: flex-end; }
.drawer[hidden] { display: none !important; }
.drawer-card {
  width: min(420px, 100vw); height: 100%; background: var(--panel); border-left: 1px solid var(--line);
  padding: 22px 24px; overflow-y: auto; box-shadow: -20px 0 50px rgba(0,0,0,.4);
}
.drawer-card h3 { font-size: 16px; display: flex; align-items: flex-start; gap: 10px; margin: 0; }
.drawer-card .dr-close {
  margin-left: auto; cursor: pointer; border: 1px solid var(--line); background: #262a3c;
  border-radius: 6px; width: 16px; height: 16px; font-size: 10px; line-height: 1; color: var(--ink-soft); flex: none;
}
.dr-sub { font-size: 12.5px; color: var(--ink-soft); margin: 4px 0 16px; }

/* -------- modal (apply wizard + pipeline detail) -------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(6,7,12,.65); display: grid; place-items: start center; padding: 7vh 16px 20px; }
.modal[hidden] { display: none !important; }
.modal-card { width: 560px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.5); padding: 20px 22px; }
.modal-card h3 { font-size: 15.5px; display: flex; align-items: flex-start; gap: 10px; margin: 0; color: var(--ink); }
.modal-card .mc-close { margin-left: auto; cursor: pointer; border: 1px solid var(--line); background: #262a3c; border-radius: 7px; width: 26px; height: 26px; font-size: 14px; line-height: 1; flex: none; color: var(--ink-soft); }
.mc-sub { font-size: 12.5px; color: var(--ink-soft); margin: 4px 0 14px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; margin-bottom: 14px; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; color: var(--ink); }
.mc-actions { display: flex; gap: 8px; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.recruiter-box { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }

/* apply wizard (rendered inside the modal) */
.steps { display: flex; align-items: center; gap: 8px; margin: 4px 0 4px; }
.step-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--ink-soft); background: #262a3c; border: 1px solid var(--line); }
.step-dot.active { background: var(--accent); border-color: var(--accent); color: #1a1200; }
.step-dot.done { background: #4a3a1a; border-color: #4a3a1a; color: var(--accent-ink); }
.step-line { flex: 1; height: 2px; background: var(--line); }
.step-caption { font-size: 12px; color: #4b5070; margin: 6px 0 14px; }

.apply-step label { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 8px; }
.apply-step input { width: 100%; font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #11131c; color: var(--ink); margin-top: 4px; }
.field-err { color: #ff9e9e; font-size: 11.5px; margin: 5px 0 0; }
.apply-step textarea {
  width: 100%; font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #11131c; color: var(--ink); margin-top: 4px; resize: vertical;
}
.skills-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 11.5px; background: #2a2110; color: var(--accent-ink); border-radius: 999px; padding: 4px 10px; display: inline-flex; align-items: center; gap: 6px; }
.chip button { border: none; background: transparent; cursor: pointer; color: var(--accent-ink); font-size: 12px; line-height: 1; }
.dropzone { position: relative; border: 1px dashed var(--line); border-radius: 9px; padding: 12px; background: #181b28; display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.dropzone input[type="file"] { font-size: 12px; color: var(--ink-soft); }
.review-box { background: #181b28; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; font-size: 13px; line-height: 1.7; min-width: 340px; }
.review-box dt { color: var(--ink-soft); display: inline-block; width: 130px; }
.step-actions { display: flex; gap: 8px; margin-top: 16px; }
.next2-slot .fake-next { cursor: pointer; background: var(--accent); color: #1a1200; border-radius: 8px; padding: 8px 16px; font-size: 13px; font-weight: 700; display: inline-block; }
.next2-slot .fake-next:hover { background: var(--accent-ink); }

.btn { font: inherit; font-size: 13px; cursor: pointer; border: 1px solid var(--line); background: #262a3c; color: var(--ink); border-radius: 8px; padding: 8px 14px; }
.btn:hover { background: #2c3146; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1200; font-weight: 700; margin-top: 2px; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.danger { border-color: #5a2323; color: #ffb3b3; background: #2a1616; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.tiny { padding: 5px 12px; font-size: 12px; }

.script-box {
  display: flex; align-items: center; gap: 10px; margin: 8px 0 14px;
  background: #181b28; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
}
.script-box code {
  flex: 1; background: none; border: none; padding: 0; font-size: 12.5px;
  white-space: pre-wrap; word-break: break-word; color: #ffd9a8;
}
.script-box .btn.tiny { flex: none; }
.confirm-banner { margin-top: 16px; border: 1px solid #2a4a3a; background: #12241a; border-radius: 10px; padding: 14px; font-size: 13.5px; color: var(--ink); }

/* -------- pipeline / kanban -------- */
.pipeline-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 10px; }
.mb-summary { font-size: 12.5px; color: var(--ink-soft); }

/* -------- admin section (Manage roles, inside Pipeline) -------- */
.admin-section { background: #171a28; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.admin-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.sec-subtitle { font-size: 13px; margin: 0; color: var(--ink); }
.admin-section-head input { font: inherit; font-size: 12.5px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #11131c; color: var(--ink); min-width: 220px; }
.admin-hint { font-size: 11.5px; margin: 0 0 10px; }
.roles-admin { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.role-row { display: grid; grid-template-columns: 1fr 130px 70px 90px 80px; align-items: center; gap: 10px; padding: 7px 10px; background: #21243a; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; }
.role-title { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-dept { color: var(--ink-soft); }
.role-status { text-transform: uppercase; font-size: 10.5px; letter-spacing: .4px; color: #7fdca0; }
.role-status.closed { color: #ff8a8a; }
.role-offers { color: var(--ink-soft); font-size: 11.5px; }
.bulk-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 8px 12px;
  background: #201d14; border: 1px solid #4a3a1a; border-radius: 9px; font-size: 12.5px; color: var(--accent-ink);
}
.bulk-bar[hidden] { display: none !important; }
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.col { flex: none; width: 240px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.col h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-soft); margin: 2px 4px 10px; display: flex; justify-content: space-between; }
.col h4 .count { background: #262a3c; border-radius: 999px; padding: 1px 7px; font-size: 10.5px; color: var(--ink); }
.pcard { background: #21243a; border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; margin-bottom: 8px; cursor: pointer; }
.pcard:hover { border-color: #3a3f5c; }
.pcard .pc-title { font-size: 12.5px; font-weight: 600; color: var(--ink); max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: clip; }
.pcard .pc-sub { font-size: 11px; color: var(--ink-soft); margin: 4px 0 6px; }
.pcard .pc-notes { font-size: 11px; color: var(--ink-soft); font-style: italic; margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .pc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard .pc-x { border: none; background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 12px; width: 18px; height: 18px; }
.pcard .pc-select { width: 14px; height: 14px; margin: 0; }

.req-match { font-size: 12px; color: var(--ink-soft); margin: 6px 0 0; }
.req-match .ok { color: var(--ok); }
.dup-warning {
  margin: 10px 0; padding: 9px 12px; font-size: 12.5px; color: #ffd98f;
  background: #3a2c10; border: 1px solid #4a3a1a; border-radius: 8px;
}

.ap-status { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 2px 8px; border-radius: 999px; }
.ap-status.submitted { color: var(--info); background: #16233a; }
.ap-status.reviewing { color: var(--accent-ink); background: #3a2c14; }
.ap-status.interview { color: #d6b8ff; background: #2b1c40; }
.ap-status.offer { color: var(--ok); background: #123326; }
.ap-status.rejected { color: var(--danger); background: #3a1616; }
.ap-status.withdrawn { color: var(--ink-soft); background: #262a3c; }

/* -------- hints -------- */
.hints-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.hint-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.hint-card .h-area { font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.hint-card .h-text { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; min-height: 18px; }
.hint-card .h-actions { display: flex; gap: 8px; margin-top: 10px; }
.hint-card .h-actions button { flex: 1; font-size: 12px; padding: 6px 8px; }
.hint-card.unlocked-precise { border-color: #4a3a1a; background: #201d14; }

/* -------- api / log -------- */
.api-table, .api-tasks { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.api-row { display: grid; grid-template-columns: 66px 1fr; gap: 12px; align-items: baseline; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.api-row:last-child { border-bottom: none; }
.api-row .m { font-family: ui-monospace, Menlo, monospace; font-weight: 700; font-size: 11px; text-align: center; border-radius: 5px; padding: 2px 0; }
.m.GET { color: #8fc4ff; background: #16233a; }
.m.POST { color: #8fe8c3; background: #123326; }
.m.PUT { color: #ffd98f; background: #3a2c10; }
.m.PATCH { color: #d6b8ff; background: #2b1c40; }
.m.DELETE { color: #ff9e9e; background: #3a1616; }
.api-ep { font-family: ui-monospace, Menlo, monospace; color: var(--ink); }
.api-note { color: var(--ink-soft); }
.task { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.task:last-child { border-bottom: none; }
.task b.tk { color: var(--accent-ink); }
.task .hint { color: #6d7292; font-size: 12px; }
.task-group { background: #21243a; padding: 8px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); }

.log { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.log .lrow { display: grid; grid-template-columns: 70px 54px 1fr auto; gap: 12px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--ink-soft); }
.log .lrow:last-child { border-bottom: none; }
.log .sc.s2 { color: var(--ok); font-weight: 700; }
.log .sc.s4 { color: var(--accent-ink); font-weight: 700; }
.log .sc.s5 { color: var(--danger); font-weight: 700; }
.log .sc.s3 { color: var(--info); font-weight: 700; }
.log-empty { padding: 22px; text-align: center; color: #6d7292; font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(14px); background: #262a3c; color: var(--ink); border: 1px solid var(--line); padding: 9px 16px; border-radius: 9px; font-size: 13px; opacity: 0; pointer-events: none; transition: all .22s ease; z-index: 90; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes exam2Flash {
  0% { box-shadow: 0 0 0 0 rgba(255, 159, 67, .5); border-color: var(--accent); }
  100% { box-shadow: 0 0 0 12px rgba(255, 159, 67, 0); }
}
.flash { animation: exam2Flash 1s ease-out; border-color: var(--accent) !important; }

/* -------- responsive -------- */
@media (min-width: 768px) and (max-width: 1024px) {
  .apply-step[data-step="2"] .dropzone { position: relative; z-index: 2; margin-top: -128px; background: #181b28; }
}
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .rail { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
  .rail-spacer { display: none; }
}
@media (max-width: 620px) {
  .job-row { grid-template-columns: 1fr; row-gap: 6px; }
  .job-row .salary, .job-row .offers { text-align: left; }
}
