/* ---------- Tokens ---------- */
:root {
    --jp-ink: #1d2430;
    --jp-muted: #667085;
    --jp-bg: #f4f5f7;
    --jp-surface: #ffffff;
    --jp-line: #e3e6ea;
    --jp-accent: #2f5bea;
    --jp-new: #2f5bea;
    --jp-progress: #b7791f;
    --jp-interview1: #0f8a7e;
    --jp-interview2: #6b46c1;
    --jp-rejected: #98a2b3;
    --jp-review: #be185d;
    --jp-star: #f59e0b;
    --jp-star-off: #d0d5dd;
    --jp-danger: #c4320a;
}

html { font-size: 15px; }
body { color: var(--jp-ink); }
body.admin { background: var(--jp-bg); min-height: 100vh; }
.validation-summary-valid { display: none; }
.btn-primary { --bs-btn-bg: var(--jp-accent); background-color: var(--jp-accent); border-color: var(--jp-accent); }
a { color: var(--jp-accent); }

.topbar { background: var(--jp-ink); }
.topbar .nav-link { color: rgba(255,255,255,.75); }
.topbar .nav-link:hover, .topbar .nav-link:focus { color: #fff; }

.card { border-color: var(--jp-line); border-radius: 10px; }
.login-card { max-width: 400px; margin: 10vh auto 0; }
.btn-ms { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; background: #fff; color: #3c4043; border: 1px solid #8c8c8c; font-weight: 600; padding: .6rem 1rem; }
.btn-ms:hover, .btn-ms:focus { background: #f3f3f3; color: #1b1b1b; border-color: #6b6b6b; }

/* ---------- Board ---------- */
.board-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-end; margin-bottom: 1.25rem; }
.board-filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.board-filters .form-select { width: auto; min-width: 220px; }
.board-filters .form-control { width: auto; min-width: 200px; }

.board {
    display: grid;
    grid-template-columns: repeat(5, minmax(220px, 1fr));
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: .5rem;
}
.board-col {
    --col: var(--jp-new);
    background: #eceef1;
    border-radius: 10px;
    border-top: 4px solid var(--col);
    display: flex; flex-direction: column;
    min-height: 60vh;
    transition: background-color .15s, box-shadow .15s;
}
.col-new { --col: var(--jp-new); }
.col-progress { --col: var(--jp-progress); }
.col-interview1 { --col: var(--jp-interview1); }
.col-interview2 { --col: var(--jp-interview2); }
.col-rejected { --col: var(--jp-rejected); }
.board-col.drop-target { background: #e2e7f5; box-shadow: inset 0 0 0 2px var(--col); }

.board-col-head { display: flex; justify-content: space-between; align-items: center; padding: .75rem .85rem .5rem; font-weight: 600; }
.board-col-head .count { background: var(--col); color: #fff; font-weight: 600; }
.board-col-body { padding: 0 .6rem .75rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.board-empty { color: var(--jp-muted); font-size: .85rem; text-align: center; padding: 1.5rem 0; border: 1px dashed #cfd4da; border-radius: 8px; }
.card-app ~ .board-empty { display: none; }

.card-app {
    position: relative;
    display: flex; gap: .65rem; align-items: flex-start;
    background: var(--jp-surface);
    border: 1px solid var(--jp-line);
    border-radius: 8px;
    padding: .65rem .7rem;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
    transition: box-shadow .15s, transform .15s;
}
.card-app:hover { box-shadow: 0 4px 12px rgba(16,24,40,.08); }
.card-app.dragging { opacity: .5; transform: rotate(1deg); }
.card-app-body { min-width: 0; }
.card-app-name { font-weight: 600; color: var(--jp-ink); text-decoration: none; display: block; overflow-wrap: anywhere; }
.card-app-job, .card-app-meta { font-size: .8rem; color: var(--jp-muted); }
.lang-tag { display: inline-block; margin-left: .25rem; padding: 0 .3rem; border: 1px solid var(--jp-line); border-radius: 4px; font-size: .7rem; font-weight: 600; letter-spacing: .03em; color: var(--jp-muted); }
.lang-choice { margin: 0; }
.lang-choice legend { font-size: 1rem; float: none; width: auto; margin-bottom: .35rem; }
.card-app-warn { position: relative; z-index: 2; font-size: .75rem; color: var(--jp-danger); font-weight: 600; margin-top: .15rem; }

.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; background: #dfe3e8; }
.avatar-lg { width: 88px; height: 88px; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; font-weight: 600; color: #475467; }

.board-toast {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 1080;
    background: var(--jp-ink); color: #fff; padding: .7rem 1rem; border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.2); transition: opacity .4s; max-width: 360px;
}
.board-toast.is-error { background: var(--jp-danger); }
.board-toast.out { opacity: 0; }

/* ---------- Details ---------- */
.applicant-message { white-space: pre-wrap; }
.status-badge { font-size: .85rem; padding: .45em .75em; }
.status-new { background: var(--jp-new); }
.status-progress { background: var(--jp-progress); }
.status-interview1 { background: var(--jp-interview1); }
.status-interview2 { background: var(--jp-interview2); }
.status-rejected { background: var(--jp-rejected); }
.status-review { background: var(--jp-review); color: #fff; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: .6rem 0 .6rem .9rem; border-left: 2px solid var(--jp-line); position: relative; }
.history li::before { content: ""; position: absolute; left: -5px; top: .9rem; width: 8px; height: 8px; border-radius: 50%; background: var(--jp-accent); }

.embed-preview { border: 1px dashed #cfd4da; border-radius: 10px; padding: 1rem; background: #fff; }

/* ---------- Public form (inside the CMS iframe) ---------- */
body.embed { background: transparent; }
.embed-main { padding: 4px; }
.apply { max-width: 760px; }
.apply-title { font-size: 1.6rem; font-weight: 600; margin-bottom: .5rem; }
.apply-intro { color: var(--jp-muted); white-space: pre-wrap; margin-bottom: 1.5rem; }
.apply-form .form-label { font-weight: 500; }
.apply-form .input-validation-error { border-color: var(--jp-danger); }
/* Error lines always reserve their space, so the form doesn't jump when a message appears or
   disappears on blur (which could otherwise make a click land next to its target). */
.apply-form .invalid-feedback { display: block; min-height: 1.35em; margin-top: .2rem; color: var(--jp-danger); font-size: .85rem; }
.apply-form .row.g-3 { --bs-gutter-y: .5rem; }
.photo-preview { margin-top: .6rem; width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--jp-line); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.apply-done { padding: 1.5rem 0; }
.done-mark { width: 48px; height: 48px; border-radius: 50%; background: var(--jp-interview1); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: 1rem; }

/* ---------- Internal review ---------- */
/* Review stage tag (board card + pop-up header) */
.card-app-tags { position: relative; z-index: 2; margin-top: .3rem; display: flex; flex-wrap: wrap; gap: .25rem; }
/* Same shape as the step badge (Bootstrap .badge); the outline is an inset shadow so it adds no size. */
.review-tag { display: inline-block; font-size: .72rem; font-weight: 700; line-height: 1; padding: .35em .65em; border-radius: .25rem; white-space: nowrap; }
.review-tag.is-active { background: #fce7f3; color: var(--jp-review); box-shadow: inset 0 0 0 1px #f9a8d4; }
.review-tag.is-done { background: #dcfae6; color: #067647; box-shadow: inset 0 0 0 1px #a6f4c5; }
/* In the pop-up header it sits under the step badge: identical size there. */
.app-head .review-tag, .app-head .status-badge { font-size: .85rem; padding: .45em .75em; min-width: 7.5rem; text-align: center; }
.card-app:has(.review-tag.is-active) { border-left: 3px solid var(--jp-review); }
.history li.history-review::before { background: var(--jp-review); }

/* Read-only stars: five glyphs filled to --pct */
.stars {
    display: inline-block; letter-spacing: 1px; line-height: 1;
    background: linear-gradient(90deg, var(--jp-star) var(--pct, 0%), var(--jp-star-off) var(--pct, 0%));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stars-num { font-weight: 600; font-size: .9em; color: var(--jp-ink); }

.review-overall { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; padding: 1rem 1.25rem; background: #fafbfc; border: 1px solid var(--jp-line); border-radius: 8px; }
.review-table th, .review-table td { font-size: .9rem; }
.review-comment { border-left: 3px solid var(--jp-line); padding: .25rem 0 .25rem .9rem; margin: 0 0 .75rem; }
.reviewer-list li { padding: .3rem 0; border-bottom: 1px solid #f0f2f4; }
.reviewer-list li:last-child { border-bottom: 0; }

/* Application pop-up */
.min-w-0 { min-width: 0; }
.flex-none { flex: none; }
#appModal .modal-content { border-radius: 12px; overflow: hidden; }
.app-head { align-items: flex-start; padding: 1.25rem 1.5rem; border-bottom: 0; }
.app-head .modal-title { overflow-wrap: anywhere; }
.app-tabs { border-bottom: 1px solid var(--jp-line); }
.app-tabs .nav-link { color: var(--jp-muted); font-weight: 500; }
.app-tabs .nav-link.active { color: var(--jp-ink); }
.app-tabs .badge { font-size: .7rem; vertical-align: 1px; }
/* Fixed height (fills the window, like the dialog's own max): header and tabs stay put, the tab content scrolls. */
#appModal .modal-content { height: 100%; }
#appModal .app-panel { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
#appModal .app-panel > .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.app-side { background: #f7f8fa; border: 1px solid var(--jp-line); border-radius: 10px; padding: 1.25rem; }
.review-round + .review-round { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--jp-line); }

/* Live e-mail preview in the move dialog */
.mail-preview { border: 1px solid var(--jp-line); border-radius: 8px; overflow: hidden; background: #f4f4f7; }
.mail-preview-head { background: #fff; border-bottom: 1px solid var(--jp-line); padding: .6rem .8rem; line-height: 1.6; }
#previewFrame { display: block; width: 100%; height: min(60vh, 560px); border: 0; background: #f4f4f7; }

/* Board | Grid switch */
.view-switch .btn { min-width: 4.5rem; }

/* Grid view */
.grid-toolbar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: -.25rem 0 .6rem; }
.app-grid .grid-select { width: 2.5rem; text-align: center; cursor: default; }
.app-grid .grid-select .form-check-input { margin: 0; cursor: pointer; }
.app-grid tbody tr.is-selected > td { background: #eef3fe; }
.bulk-names { max-height: 9rem; overflow-y: auto; padding-left: 1.1rem; }
.app-grid thead th { background: #f7f8fa; border-bottom: 1px solid var(--jp-line); white-space: nowrap; font-size: .85rem; position: sticky; top: 0; z-index: 1; }
.th-inner { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.th-sort { background: none; border: 0; padding: 0; font-weight: 600; color: var(--jp-ink); text-align: left; }
.th-sort-mark { font-size: .65rem; color: var(--jp-muted); margin-left: .15rem; }
.th-filter { background: #fff; border: 1px solid var(--jp-line); border-radius: 4px; color: var(--jp-muted); width: 24px; height: 22px;
             display: inline-flex; align-items: center; justify-content: center; padding: 0; flex: none; }
.th-filter:hover { color: var(--jp-ink); border-color: #b9c0c9; }
.th-filter.active { background: var(--jp-accent); border-color: var(--jp-accent); color: #fff; }
.app-grid tbody tr { cursor: pointer; }
.app-grid tbody tr:focus-visible { outline: 2px solid var(--jp-accent); outline-offset: -2px; }
.app-grid td { font-size: .9rem; }
.app-grid .grid-name { color: var(--jp-ink); text-decoration: none; }
.app-grid .grid-name:hover { text-decoration: underline; }
.app-grid .status-badge { font-size: .75rem; }
.app-grid .review-tag { margin-left: .25rem; vertical-align: 1px; }
.grid-docs a { margin-right: .6rem; white-space: nowrap; }
.app-grid .grid-tel { color: var(--jp-ink); text-decoration: none; }
.app-grid .grid-tel:hover { text-decoration: underline; }
.contact-list { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; }
.contact-list dt { font-weight: 500; color: var(--jp-muted); }
.contact-list dd { margin: 0; }
.grid-menu { position: absolute; z-index: 1060; width: 270px; background: #fff; border: 1px solid var(--jp-line); border-radius: 8px; padding: .5rem; font-size: .875rem; }
.grid-menu hr { margin: .35rem 0; }
.grid-menu-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .35rem .5rem; border-radius: 4px; }
.grid-menu-item:hover:not(:disabled) { background: #f0f2f5; }
.grid-menu-item:disabled { color: #b0b6bf; }
.grid-menu-list { max-height: 230px; overflow-y: auto; border: 1px solid var(--jp-line); border-radius: 4px; padding: .3rem .5rem; }
.grid-menu-list label { display: flex; gap: .45rem; align-items: center; padding: .15rem 0; cursor: pointer; }
.grid-menu-list label[hidden] { display: none; }
.grid-menu-list .form-check-input { margin: 0; flex: none; }
.grid-menu-all { border-bottom: 1px solid #f0f2f4; margin-bottom: .15rem; }
.grid-menu-actions { display: flex; justify-content: flex-end; gap: .4rem; margin-top: .5rem; }

/* Question editor (job posting form) */
.q-head, .q-row { display: grid; grid-template-columns: 1.6rem 1fr 1fr auto; gap: .4rem; align-items: center; }
.q-head { margin-bottom: .2rem; }
.q-row { margin-bottom: .4rem; }
.q-num { color: var(--jp-muted); font-size: .85rem; text-align: right; }
.q-actions { display: inline-flex; gap: .15rem; }
.q-actions .btn { padding: .1rem .45rem; }
@media (max-width: 767px) {
    .q-head { display: none; }
    .q-row { grid-template-columns: 1.6rem 1fr; }
    .q-row > input[data-f=TextDK], .q-actions { grid-column: 2; }
}

/* Reviewer page */
.review-page { max-width: 820px; margin: 0 auto; }
.review-note { background: #f3f4f6; border-left: 4px solid var(--jp-ink); border-radius: 8px; padding: .8rem 1rem; }
.rating-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid #f0f2f4; margin: 0; }
.rating-row:last-child { border-bottom: 0; }
.rating-row.is-missing .rating-q { color: var(--jp-danger); }
.rating-q { float: none; width: auto; margin: 0; font-size: 1rem; }

/* Star input: radios in order 5..1, shown reversed so hover/checked fills to the left */
.star-input { display: inline-flex; flex-direction: row-reverse; flex: none; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { font-size: 1.9rem; line-height: 1; padding: 0 .1rem; color: var(--jp-star-off); cursor: pointer; transition: color .1s, transform .1s; }
.star-input input:checked ~ label,
.star-input:not(:has(input:disabled)) label:hover,
.star-input:not(:has(input:disabled)) label:hover ~ label { color: var(--jp-star); }
.star-input input:focus-visible + label { outline: 2px solid var(--jp-accent); outline-offset: 2px; border-radius: 4px; }
.star-input input:disabled + label { cursor: default; }
.star-input:not(:has(input:disabled)) label:active { transform: scale(.9); }

@media (max-width: 575px) {
    .rating-row { flex-direction: column; align-items: flex-start; gap: .25rem; }
    .board-filters, .board-filters .form-select, .board-filters .form-control { width: 100%; min-width: 0; }
}

/* E-mail viewer: a layer over the application pop-up (History tab → View e-mail). */
.mail-viewer { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; background: #fff; border-radius: inherit; }
.mail-viewer-head { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.25rem; border-bottom: 1px solid #e5e7eb; }
.mail-viewer-meta { padding: .6rem 1.25rem; border-bottom: 1px solid #e5e7eb; }
.mail-viewer iframe { flex: 1; width: 100%; border: 0; background: #f4f4f7; }
.mail-viewer-rebuilt { margin-top: .25rem; color: #92400e; }

/* Internal notes history (Details tab): cards like the Discussion tab in DevOps Query Viewer. */
.note-card .card-body { padding: .75rem 1rem; }
.note-card hr { margin: .5rem 0; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Images in the CRUD screens (company logos): on the e-mail header colour, since logos are made for it. */
.crud-image { display: inline-block; background: var(--jp-mail-brand, #0057A8); border-radius: 6px; padding: .6rem 1rem; }
.crud-image img { display: block; max-height: 48px; max-width: 260px; }
.crud-image-sm { padding: .3rem .6rem; }
.crud-image-sm img { max-height: 28px; max-width: 140px; }
.crud-multiline { white-space: pre-line; }
