/* StaffHero CVs - application styles */

:root {
    --bg:          #f1f5f9;
    --surface:     #ffffff;
    --sidebar:     #0f172a;
    --sidebar-ink: #94a3b8;
    --ink:         #0f172a;
    --muted:       #64748b;
    --line:        #e2e8f0;
    --brand:       #2563eb;
    --brand-dark:  #1d4ed8;
    --ok:          #059669;
    --ok-bg:       #ecfdf5;
    --warn:        #d97706;
    --warn-bg:     #fffbeb;
    --bad:         #dc2626;
    --bad-bg:      #fef2f2;
    --info-bg:     #eff6ff;
    --radius:      10px;
    --shadow:      0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Application shell ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    flex-shrink: 0;
    background: var(--sidebar);
    color: var(--sidebar-ink);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .brand {
    padding: 20px 20px 16px;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.01em;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar .brand span { color: var(--brand); }
.sidebar .brand small {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--sidebar-ink);
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar nav { padding: 12px 10px; flex: 1; overflow-y: auto; }

.sidebar nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: 8px;
    color: var(--sidebar-ink);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar nav a.active { background: var(--brand); color: #fff; }
.sidebar nav .group {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #475569;
    padding: 16px 12px 6px;
    font-weight: 700;
}
.sidebar nav .count {
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
}
.sidebar nav a.active .count { background: rgba(0, 0, 0, .25); }

.sidebar .signed-in {
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding: 14px 20px;
    font-size: 13px;
}
.sidebar .signed-in strong { color: #fff; display: block; }
.sidebar .signed-in form { margin-top: 6px; }
.sidebar .signed-in button {
    background: none; border: 0; padding: 0;
    color: var(--sidebar-ink); font: inherit; font-size: 12px; cursor: pointer;
}
.sidebar .signed-in button:hover { color: #fff; text-decoration: underline; }

.main { flex: 1; min-width: 0; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.topbar h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.topbar .actions { display: flex; gap: 8px; align-items: center; }

.content { padding: 24px 28px 60px; max-width: 1400px; }

/* ---------- Cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.card-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ---------- Stat tiles ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 28px; font-weight: 700; line-height: 1.15; margin-top: 4px; letter-spacing: -.02em; }
.stat .value a { color: inherit; }
.stat .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 700;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
    white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafc; }
td.right, th.right { text-align: right; }
td.nowrap, th.nowrap { white-space: nowrap; }
.table-wrap { overflow-x: auto; }

.candidate-name { font-weight: 600; display: block; }
.candidate-email { color: var(--muted); font-size: 13px; }

/* Notes column in the candidate list - shows the latest note inline. */
.notes-col { min-width: 260px; }
.note-snippet {
    display: block;
    color: var(--ink);
    line-height: 1.4;
}
.note-more {
    display: inline-block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: #f1f5f9;
    color: #475569;
}
.badge-new         { background: var(--info-bg); color: #1d4ed8; }
.badge-reviewed    { background: #f1f5f9;       color: #475569; }
.badge-shortlisted { background: var(--ok-bg);  color: #047857; }
.badge-assessment_sent { background: var(--warn-bg); color: #b45309; }
.badge-assessment_done { background: #f5f3ff;   color: #6d28d9; }
.badge-interview_scheduled { background: #ecfeff; color: #0e7490; }
.badge-hired       { background: var(--ok-bg);  color: #065f46; }
.badge-rejected    { background: var(--bad-bg); color: #b91c1c; }
.badge-pass        { background: var(--ok-bg);  color: #047857; }
.badge-fail        { background: var(--bad-bg); color: #b91c1c; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 550;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; color: var(--ink); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Forms ---------- */

label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=datetime-local], input[type=date], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--brand);
    outline-offset: -1px;
    border-color: var(--brand);
}
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 16px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; }
.checkbox input { width: auto; }
fieldset { border: 0; padding: 0; margin: 0 0 26px; }
fieldset legend {
    font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); font-weight: 700; padding: 0; margin-bottom: 12px;
}

/* ---------- Filter bar ---------- */

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.filters .field { margin-bottom: 0; min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 220px; }
.filters .field.check { min-width: 0; padding-bottom: 9px; }

/* ---------- Alerts ---------- */

.alert { padding: 11px 15px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.alert-success { background: var(--ok-bg);   color: #065f46; border-color: #a7f3d0; }
.alert-error   { background: var(--bad-bg);  color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--warn-bg); color: #92400e; border-color: #fde68a; }
.alert-info    { background: var(--info-bg); color: #1e40af; border-color: #bfdbfe; }
.alert strong { font-weight: 700; }

/* ---------- Empty state ---------- */

.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty h3 { margin: 0 0 6px; font-size: 16px; color: var(--ink); }
.empty p { margin: 0 auto 16px; max-width: 420px; font-size: 14px; }

/* ---------- Candidate detail ---------- */

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.email-body {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    max-height: 420px;
    overflow-y: auto;
}
.attachment {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
}
.attachment:last-child { border-bottom: 0; }
.attachment .name { font-weight: 600; font-size: 14px; word-break: break-all; }
.attachment .meta { font-size: 12px; color: var(--muted); }

.note { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.note:last-child { border-bottom: 0; }
.note .body { white-space: pre-wrap; font-size: 14px; }
.note .meta { font-size: 12px; color: var(--muted); margin-top: 5px; display: flex; justify-content: space-between; gap: 8px; }
.note .meta button { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 12px; padding: 0; }
.note .meta button:hover { color: var(--bad); text-decoration: underline; }

.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); white-space: nowrap; }

.stars { display: inline-flex; gap: 2px; }
.stars button {
    background: none; border: 0; cursor: pointer; padding: 0 1px;
    font-size: 17px; line-height: 1; color: #cbd5e1;
}
.stars button.on { color: #f59e0b; }

.kv { margin: 0; font-size: 14px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 550; word-break: break-word; }

/* ---------- Pipeline stepper ---------- */

.pipeline { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; }
.pipeline .step {
    flex: 1;
    min-width: 92px;
    padding: 8px 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px;
    text-align: center;
    color: var(--muted);
}
.pipeline .step.done { background: var(--ok-bg); border-color: #a7f3d0; color: #047857; font-weight: 600; }
.pipeline .step.current { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ---------- Public pages (login, assessment, booking) ---------- */

.public {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    background: var(--sidebar);
}
.public-card {
    background: var(--surface);
    width: 100%;
    max-width: 460px;
    border-radius: 14px;
    padding: 32px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.public-card.wide { max-width: 760px; }
.public-card h1 { margin: 0 0 4px; font-size: 21px; }
.public-card .sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.public-card .btn { width: 100%; justify-content: center; }

.question { padding: 20px 0; border-bottom: 1px solid var(--line); }
.question:last-of-type { border-bottom: 0; }
.question .prompt { font-weight: 600; margin-bottom: 12px; }
.question .prompt .num { color: var(--muted); font-weight: 500; margin-right: 6px; }
.option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 7px;
    cursor: pointer;
    font-weight: 400;
    font-size: 14px;
}
.option:hover { background: #f8fafc; }
.option input { width: auto; margin: 3px 0 0; }
.option.correct { border-color: #a7f3d0; background: var(--ok-bg); }
.option.chosen-wrong { border-color: #fecaca; background: var(--bad-bg); }

.slot-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.slot {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
}
.slot:hover { border-color: var(--brand); background: var(--info-bg); }
.slot .day { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.slot .time { font-size: 17px; font-weight: 700; margin-top: 2px; }
.slot input { display: none; }
.slot.selected { border-color: var(--brand); background: var(--info-bg); box-shadow: 0 0 0 1px var(--brand); }

/* ---------- Utilities ---------- */

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 16px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.inline-form { display: inline; }
.copy-field { display: flex; gap: 6px; }
.copy-field input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
    .detail { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .sidebar nav .group { display: none; }
    .content, .topbar { padding-left: 16px; padding-right: 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Company name under the brand for client logins */
.sidebar .brand .company { display: block; font-size: 12px; font-weight: 500; color: var(--sidebar-ink); margin-top: 6px; letter-spacing: 0; text-transform: none; }
.intake-tag { display: inline-block; font-size: 11px; color: var(--muted); background: var(--bg); border-radius: 4px; padding: 1px 6px; margin-left: 6px; }

/* Client colour tags (clients.colour, or a default by id) */
tr.client-row td:first-child { box-shadow: inset 4px 0 0 var(--client); }
.client-pill { display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.5; padding: 1px 8px; border-radius: 999px;
    color: var(--client); background: color-mix(in srgb, var(--client) 12%, white); border: 1px solid color-mix(in srgb, var(--client) 35%, white); }
.client-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--client); margin-right: 6px; vertical-align: 1px; }
