/* ═══════════════════════════════════════════════════
   RioHire — candidate portal (phone-first) + staff console
   Palette and components follow docs/mockups.html.
   ═══════════════════════════════════════════════════ */

:root {
  --bg: #f3f4f1; --panel: #ffffff; --ink: #1b1f1d; --muted: #5f6763; --line: #d9ddd8; --soft: #eef0ec;
  --accent: #0f6e56; --accent-ink: #ffffff; --accent-soft: #dcefe6;
  --good: #1a7f4b; --warn: #b26a00; --bad: #b4302b; --good-soft: #dff3e6; --warn-soft: #fff0d6; --bad-soft: #fbe1df;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --radius: 10px; --radius-sm: 7px; --shadow: 0 1px 2px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #141715; --panel: #1d211e; --ink: #eef1ed; --muted: #9aa39d; --line: #343a36; --soft: #262b28;
  --accent: #4fbf9b; --accent-ink: #0d1a15; --accent-soft: #1f3a31;
  --good: #5ccf8d; --warn: #f0b85c; --bad: #f08a84; --good-soft: #1d3327; --warn-soft: #3b2c12; --bad-soft: #3f1f1d; color-scheme: dark; } }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; text-wrap: balance; }
h2 { font-size: 17px; margin: 0 0 6px; }
h3 { font-size: 14px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
code { font-family: var(--mono); font-size: .9em; }
.hint { font-size: 12px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }
.timer { font-family: var(--mono); font-size: 13px; color: var(--warn); font-weight: 500; }
.timer.bad { color: var(--bad); }
.score { font-family: var(--mono); font-size: 26px; font-weight: 500; line-height: 1; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.page-center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.empty-shell { min-height: 100vh; }

/* ── Buttons & inputs ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: .15s; }
.btn:hover:not(:disabled) { border-color: var(--muted); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.p { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.p:hover:not(:disabled) { filter: brightness(1.08); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.good { color: var(--good); border-color: var(--good); }
.btn:focus-visible, .in:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.link:disabled { color: var(--muted); cursor: default; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.in { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: var(--radius-sm); padding: 9px 11px; font: inherit; width: 100%; }
.in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.in.otp { letter-spacing: .3em; font-size: 18px; text-align: center; font-family: var(--mono); }
.in.auto { width: auto; }
.in.narrow { width: 7rem; }
textarea.in { resize: vertical; min-height: 2.5rem; }
select.in { appearance: auto; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; }
.check input { margin-top: 3px; flex: none; }

/* ── Pills, cards, notes ── */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.acc { background: var(--accent-soft); color: var(--accent); }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--panel); margin-bottom: 12px; }
.card.accent { border-color: var(--accent); }
.card.dashed { border-style: dashed; text-align: center; padding: 18px; }
.card.empty { text-align: center; padding: 3rem 1.5rem; }
.card.empty i { font-size: 2.2rem; color: var(--muted); margin-bottom: .75rem; }
.card.stat { padding: 12px; margin: 0; }
.note { background: var(--soft); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.note.warn { background: var(--warn-soft); color: var(--warn); } .note.bad { background: var(--bad-soft); color: var(--bad); } .note.good { background: var(--good-soft); color: var(--good); } .note.acc { background: var(--accent-soft); color: var(--accent); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.bar { height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.bar b { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.quote { border-left: 2px solid var(--accent); padding-left: 10px; font-style: italic; color: var(--muted); font-size: 12.5px; margin: 6px 0; }
.remark { border-left: 3px solid var(--line); padding: 6px 12px; margin-bottom: 10px; }
.remark small { color: var(--muted); display: block; }
.flags span { display: inline-block; margin: 2px 4px 2px 0; }
ul.tight { margin: 4px 0 10px; padding-left: 18px; font-size: 13px; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: var(--accent); display: inline-flex; align-items: center; gap: 8px; }
.brand small { font-weight: 400; color: var(--muted); font-size: 12px; }
.brand:hover { text-decoration: none; }

/* ── Tables ── */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--soft); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs span, .tabs a { padding: 8px 12px; font-weight: 500; color: var(--muted); white-space: nowrap; cursor: pointer; border-bottom: 2px solid transparent; }
.tabs .on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* ── Steps (candidate stage progress) ── */
.steps { display: flex; margin: 18px 0 22px; }
.steps div { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); position: relative; padding-top: 18px; }
.steps div::before { content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.steps div::after { content: ""; position: absolute; top: 8px; left: 50%; width: 100%; height: 2px; background: var(--line); }
.steps div:last-child::after { display: none; }
.steps div.done::before, .steps div.done::after { background: var(--good); }
.steps div.now::before { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.steps div.now { color: var(--accent); font-weight: 600; }

/* ── Tests ── */
.likert { display: flex; gap: 6px; justify-content: space-between; margin-top: 8px; }
.likert button { flex: 1; text-align: center; border: 1px solid var(--line); border-radius: 6px; padding: 10px 0; font: inherit; font-size: 13px; background: var(--panel); color: var(--ink); cursor: pointer; }
.likert button.pick { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; background: var(--panel); width: 100%; text-align: left; font: inherit; color: var(--ink); }
.opt i { width: 14px; height: 14px; border: 2px solid var(--line); border-radius: 50%; margin-top: 3px; flex: none; }
.opt.multi i { border-radius: 3px; }
.opt.pick { border-color: var(--accent); background: var(--accent-soft); } .opt.pick i { border-color: var(--accent); background: var(--accent); }
.q-text { font-size: 15px; line-height: 1.45; margin: 10px 0 12px; font-weight: 600; }

/* ── Camera ── */
.cam { background: var(--soft); border-radius: 10px; aspect-ratio: 16/9; width: 100%; position: relative; display: grid; place-items: center; color: var(--muted); font-size: 12px; overflow: hidden; }
.cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam .face { position: absolute; width: 34%; aspect-ratio: 3/4; border: 2px dashed var(--accent); border-radius: 50%; left: 33%; top: 12%; pointer-events: none; }
.cam .face.ok { border-style: solid; opacity: .6; }
.cam .rec { position: absolute; top: 10px; left: 10px; font-family: var(--mono); font-size: 11px; color: var(--bad); font-weight: 600; background: rgba(255,255,255,.7); padding: 2px 6px; border-radius: 4px; }
.cam .live { position: absolute; bottom: 10px; left: 10px; right: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.cam .live span { background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 2px 7px; font-family: var(--mono); font-size: 10.5px; color: var(--ink); }
.cam .dot { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); left: calc(50% - 7px); top: calc(50% - 7px); box-shadow: 0 0 0 6px var(--accent-soft); }
.thumbs { display: flex; gap: 6px; }
.rec-video { width: 100%; aspect-ratio: 4/3; background: #000; border-radius: 6px; display: block; } .thumbs img, .thumbs .cam { aspect-ratio: 4/3; width: 100%; border-radius: 6px; object-fit: cover; }

/* ── Candidate shell (phone-first) ── */
.cand-shell { min-height: 100vh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }
.cand-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.cand-nav { display: flex; gap: 4px; }
.cand-nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); font-size: 13px; }
.cand-nav a:hover { background: var(--soft); color: var(--ink); text-decoration: none; }
.cand-main { flex: 1; padding: 20px 16px 32px; }
.cand-foot { text-align: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.phone-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.phone-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }

/* ── Staff shell ── */
.staff-shell { display: flex; min-height: 100vh; }
.sidebar { width: 230px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--ink); font-weight: 500; }
.sidebar nav a:hover { background: var(--soft); text-decoration: none; }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar nav a i { width: 1.1rem; text-align: center; }
.sidebar .role { margin-top: 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 0 10px 4px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user .name { font-weight: 600; font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; }
.sidebar-foot { margin-top: auto; }
.staff-content { flex: 1; padding: 24px 28px 40px; max-width: 1280px; min-width: 0; }
.menu-toggle { display: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.stats { margin-bottom: 16px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; align-items: start; }
.three { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, .9fr); gap: 14px; margin-top: 10px; }
.modal-bg { position: fixed; inset: 0; background: rgba(27,31,29,.45); display: grid; place-items: center; padding: 20px; z-index: 100; }
.modal-bg .card { max-width: 460px; width: 100%; margin: 0; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.radar { width: 100%; max-width: 280px; height: auto; }
.settings-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: start; }
.settings-nav { padding: 6px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; }
.settings-nav a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; color: var(--ink); font-weight: 500; }
.settings-nav a:hover { background: var(--soft); text-decoration: none; }
.settings-nav a.active { background: var(--accent-soft); color: var(--accent); }
.settings-nav a i { width: 1.1rem; text-align: center; }
.source-badge { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.switch { display: inline-flex !important; align-items: center; gap: 8px; }
.switch input { width: 2.6rem; height: 1.4rem; appearance: none; background: var(--line); border-radius: 999px; position: relative; cursor: pointer; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 1.1rem; height: 1.1rem; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked { background: var(--accent); } .switch input:checked::after { left: calc(100% - 1.25rem); }
.toolbar { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left .2s; box-shadow: 0 4px 20px rgba(0,0,0,.2); }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); margin-bottom: 12px; cursor: pointer; color: var(--ink); }
  .staff-content { padding: 16px; }
  .two, .three, .settings-grid { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}
@media print { .sidebar, .menu-toggle, .page-head .row, .tabs { display: none !important; } .staff-content { padding: 0; } body { background: #fff; } }

/* ── Exam proctoring: floating camera during a test ── */
.proctor-float { position: fixed; right: 16px; bottom: 16px; width: 200px; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.cam.mini { aspect-ratio: 4/3; border-radius: 6px; }
.proctor-status { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.3; }
@media (max-width: 560px) { .proctor-float { width: 132px; right: 8px; bottom: 8px; } }
