:root {
  --bg:#f4f6fb; --surface:#fff; --surface-2:#f8fafc; --border:#e6e9f0;
  --text:#1f2433; --text-soft:#5b6478; --text-faint:#8a93a6;
  --primary:#334155; --primary-dark:#1f2937; --primary-soft:#eef1f5;
  --shadow:0 1px 3px rgba(20,25,50,.06), 0 8px 24px rgba(20,25,50,.06);
  --shadow-lg:0 12px 40px rgba(20,25,50,.18);
  --radius:14px; --radius-sm:9px;
  --green-bg:#e2f7ec; --green-fg:#137a47;
  --amber-bg:#fff1dd; --amber-fg:#c2700a;
  --red-bg:#fde7e9; --red-fg:#c0314a;
  --blue-bg:#e9eef5; --blue-fg:#3f5a82;
  --purple-bg:#edeef3; --purple-fg:#566179;
  --gray-bg:#eef1f6; --gray-fg:#5b6478;
}
* { box-sizing:border-box; }
html,body { margin:0; padding:0; }
body { font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg); color:var(--text); line-height:1.5; font-size:15px; -webkit-font-smoothing:antialiased; }
a { color:var(--primary); }
.hidden { display:none !important; }

/* ---------- Login ---------- */
#login { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px;
  background:linear-gradient(160deg,#f4f6fb 0%,#e9ecf3 100%); }
.login-card { background:var(--surface); border-radius:18px; box-shadow:var(--shadow-lg); padding:34px 32px; width:100%; max-width:400px; }
.login-card .logo { display:flex; align-items:center; gap:11px; margin-bottom:6px; }
.login-card .logo .mark { width:42px; height:42px; border-radius:11px; background:#334155; color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:800; font-size:20px; }
.login-card h1 { font-size:20px; margin:0; }
.login-card .sub { color:var(--text-soft); font-size:13.5px; margin:2px 0 22px; }
.login-card label { font-size:13px; font-weight:600; color:var(--text-soft); display:block; margin-bottom:6px; }
.login-card input { width:100%; border:1px solid var(--border); border-radius:var(--radius-sm); padding:11px 13px; font-size:15px; margin-bottom:16px; font-family:inherit; }
.login-card input:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-soft); }
.login-err { background:var(--red-bg); color:var(--red-fg); border-radius:var(--radius-sm); padding:10px 13px; font-size:13.5px; margin-bottom:16px; }
.login-hint { margin-top:20px; font-size:12px; color:var(--text-faint); line-height:1.7; border-top:1px solid var(--border); padding-top:14px; }
.login-hint code { background:var(--surface-2); padding:1px 5px; border-radius:5px; }

/* ---------- App shell ---------- */
header.topbar { background:#232a36; color:#fff; box-shadow:0 1px 0 rgba(0,0,0,.04), 0 2px 10px rgba(20,25,50,.08); }
.topbar-inner { max-width:1180px; margin:0 auto; padding:16px 24px; display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.topbar .brand { display:flex; align-items:center; gap:11px; }
.topbar .brand .mark { width:34px; height:34px; border-radius:9px; background:rgba(255,255,255,.18); display:flex; align-items:center; justify-content:center; font-weight:800; }
.topbar .brand h1 { font-size:18px; margin:0; font-weight:700; }
.topbar .brand small { display:block; font-size:11.5px; opacity:.85; }
.topbar .who { display:flex; align-items:center; gap:14px; font-size:13.5px; }
.topbar .who .role-chip { background:rgba(255,255,255,.18); border:1px solid rgba(255,255,255,.28); padding:3px 10px; border-radius:999px; font-weight:600; text-transform:capitalize; }

nav.tabs { max-width:1180px; margin:0 auto; padding:0 24px; display:flex; gap:4px; border-bottom:1px solid var(--border); flex-wrap:wrap; background:var(--surface); }
nav.tabs.shell { background:var(--surface); border-bottom:1px solid var(--border); }
.wrap { max-width:1180px; margin:0 auto; padding:24px; }
.tabbar { display:flex; gap:4px; border-bottom:1px solid var(--border); margin-bottom:24px; flex-wrap:wrap; }
.tab { background:none; border:none; cursor:pointer; font-size:15px; font-weight:600; color:var(--text-soft); padding:11px 16px; border-bottom:3px solid transparent; margin-bottom:-1px; }
.tab:hover { color:var(--text); }
.tab.active { color:var(--primary); border-bottom-color:var(--primary); }

.section-title { font-size:18px; font-weight:700; margin:0 0 6px; letter-spacing:-.2px; }
.section-sub { color:var(--text-soft); font-size:13.5px; margin:0 0 20px; }
.muted { color:var(--text-soft); }
.row-between { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:16px; }

/* ---------- Buttons ---------- */
.btn { border:none; cursor:pointer; font-size:14px; font-weight:600; padding:10px 16px; border-radius:var(--radius-sm); line-height:1.4;
  transition:background .15s, transform .05s; display:inline-flex; align-items:center; gap:7px; font-family:inherit; }
.btn:active { transform:translateY(1px); }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-dark); }
.btn-ghost { background:var(--surface); color:var(--text); border:1px solid var(--border); }
.btn-ghost:hover { background:var(--surface-2); }
.btn-danger { background:var(--red-bg); color:var(--red-fg); }
.btn-danger:hover { background:#fbd3d8; }
.btn-sm { padding:7px 12px; font-size:13px; }
.btn-block { width:100%; justify-content:center; }

/* ---------- KPI ---------- */
.kpi-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:16px; margin-bottom:26px; }
.kpi { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px; box-shadow:var(--shadow); position:relative; overflow:hidden; }
.kpi .accent { position:absolute; left:0; top:0; bottom:0; width:4px; }
.kpi .label { font-size:12px; color:var(--text-soft); font-weight:600; text-transform:uppercase; letter-spacing:.4px; }
.kpi .value { font-size:30px; font-weight:700; margin-top:8px; letter-spacing:-.5px; }
.kpi .sub { font-size:12.5px; color:var(--text-faint); margin-top:3px; }

/* ---------- Panels & charts ---------- */
.panel-grid { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
@media (max-width:820px){ .panel-grid { grid-template-columns:1fr; } }
.panel { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); padding:20px 22px; margin-bottom:18px; }
.panel h3 { margin:0 0 2px; font-size:15px; }
.panel .ph-sub { color:var(--text-soft); font-size:12.5px; margin-bottom:12px; }
.bar-row { display:grid; grid-template-columns:140px 1fr 40px; align-items:center; gap:12px; margin:10px 0; }
.bar-row .bl { font-size:13px; color:var(--text-soft); font-weight:600; }
.bar-track { background:var(--surface-2); border:1px solid var(--border); border-radius:999px; height:15px; overflow:hidden; }
.bar-fill { height:100%; border-radius:999px; min-width:3px; transition:width .5s ease; }
.bar-val { font-size:13px; font-weight:700; text-align:right; }

/* ---------- Tables ---------- */
.toolbar { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-bottom:16px; }
.toolbar input[type=search], .toolbar select { border:1px solid var(--border); border-radius:var(--radius-sm); padding:9px 12px; font-size:14px; background:var(--surface); color:var(--text); font-family:inherit; }
.toolbar input[type=search] { min-width:220px; flex:1; }
.table-wrap { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); overflow:auto; }
table { width:100%; border-collapse:collapse; }
thead th { text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:.5px; color:var(--text-soft); padding:13px 16px; background:var(--surface-2); border-bottom:1px solid var(--border); white-space:nowrap; }
tbody td { padding:13px 16px; border-bottom:1px solid var(--border); font-size:14px; vertical-align:middle; }
tbody tr.clickable { cursor:pointer; transition:background .12s; }
tbody tr.clickable:hover { background:var(--primary-soft); }
tbody tr:last-child td { border-bottom:none; }
.cell-strong { font-weight:600; }
.cell-strong small { display:block; font-weight:500; color:var(--text-faint); font-size:12.5px; }
.empty { padding:46px 20px; text-align:center; color:var(--text-faint); }
.count-note { color:var(--text-soft); font-size:13px; margin-top:12px; }

/* ---------- Badges ---------- */
.badge { display:inline-block; font-size:12px; font-weight:700; padding:4px 10px; border-radius:999px; white-space:nowrap; line-height:1.5; }
.dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:7px; vertical-align:middle; }

/* ---------- Forms ---------- */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); padding:22px 24px; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px 20px; }
@media (max-width:640px){ .form-grid { grid-template-columns:1fr; } }
.field { display:flex; flex-direction:column; gap:6px; }
.field.full { grid-column:1/-1; }
.field label { font-size:13px; font-weight:600; color:var(--text-soft); }
.field label .req { color:#d23a52; }
.field input, .field select, .field textarea { border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px; font-size:14px; font-family:inherit; background:var(--surface); color:var(--text); line-height:1.5; }
.field input:focus, .field select:focus, .field textarea:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-soft); }
.field textarea { resize:vertical; min-height:84px; }
.field .ro { padding:10px 12px; background:var(--surface-2); border:1px dashed var(--border); border-radius:var(--radius-sm); font-size:14px; color:var(--text-soft); }
.hint { font-size:12.5px; color:var(--text-faint); }
.form-actions { display:flex; gap:10px; margin-top:22px; }

/* ---------- Drawer ---------- */
.overlay { position:fixed; inset:0; background:rgba(20,25,50,.45); display:none; z-index:50; }
.overlay.open { display:block; }
.drawer { position:fixed; top:0; right:0; bottom:0; width:600px; max-width:96vw; background:var(--surface); box-shadow:var(--shadow-lg);
  z-index:60; transform:translateX(100%); transition:transform .28s cubic-bezier(.4,0,.2,1); display:flex; flex-direction:column; }
.drawer.open { transform:none; }
.drawer-head { padding:20px 24px; border-bottom:1px solid var(--border); display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.drawer-head h2 { margin:0 0 4px; font-size:19px; }
.drawer-head .meta { font-size:13px; color:var(--text-soft); }
.x-btn { background:var(--surface-2); border:1px solid var(--border); border-radius:8px; width:34px; height:34px; cursor:pointer; font-size:18px; color:var(--text-soft); line-height:1; flex-shrink:0; }
.x-btn:hover { background:#eceff5; }
.drawer-body { padding:22px 24px; overflow-y:auto; flex:1; }
.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px 18px; }
.detail-grid .full { grid-column:1/-1; }
.dl label { font-size:11.5px; text-transform:uppercase; letter-spacing:.4px; color:var(--text-faint); font-weight:700; display:block; margin-bottom:3px; }
.dl .val { font-size:14.5px; }
.sub-head { font-size:14px; font-weight:700; margin:24px 0 12px; display:flex; align-items:center; justify-content:space-between; }

/* timeline */
.timeline { border-left:2px solid var(--border); margin-left:6px; padding-left:18px; }
.tl-item { position:relative; padding-bottom:16px; }
.tl-item:last-child { padding-bottom:0; }
.tl-item .tl-dot { position:absolute; left:-25px; top:3px; width:11px; height:11px; border-radius:50%; background:var(--primary); border:2px solid var(--surface); }
.tl-item .tl-status { font-weight:700; font-size:13.5px; }
.tl-item .tl-meta { font-size:12px; color:var(--text-faint); }
.tl-item .tl-note { font-size:13px; color:var(--text-soft); margin-top:2px; }

/* candidates */
.cand { border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px 14px; margin-bottom:10px; background:var(--surface-2); }
.cand .top { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.cand .nm { font-weight:700; font-size:14.5px; }
.cand .info { font-size:13px; color:var(--text-soft); margin-top:4px; }
.cand .info span { margin-right:14px; }
.cand .rm { background:none; border:none; color:var(--text-faint); cursor:pointer; font-size:13px; padding:2px 6px; }
.cand .rm:hover { color:var(--red-fg); }
.inline-form { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:8px; padding:14px; border:1px dashed var(--border); border-radius:var(--radius-sm); }
.inline-form .full { grid-column:1/-1; }
.inline-form input, .inline-form select { border:1px solid var(--border); border-radius:8px; padding:8px 10px; font-size:13.5px; font-family:inherit; width:100%; }

.status-box { background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:14px; margin-bottom:8px; }
.status-box .row { display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap; }
.status-box select, .status-box input { border:1px solid var(--border); border-radius:8px; padding:9px 11px; font-size:14px; font-family:inherit; }
.status-box .grow { flex:1; min-width:160px; }

/* ---------- Toast ---------- */
#toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(20px); background:#1f2433; color:#fff; padding:12px 20px; border-radius:10px; font-size:14px; font-weight:500; opacity:0; pointer-events:none; transition:all .25s; z-index:80; box-shadow:var(--shadow-lg); }
#toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
#toast.err { background:#c0314a; }
.pill-tabs { display:flex; gap:6px; margin-bottom:18px; flex-wrap:wrap; }
.pill { background:var(--surface); border:1px solid var(--border); border-radius:999px; padding:7px 16px; font-size:13.5px; font-weight:600; cursor:pointer; color:var(--text-soft); }
.pill.active { background:var(--primary); color:#fff; border-color:var(--primary); }

/* ---------- Google sign-in & access states ---------- */
.gbtn { display:flex; align-items:center; justify-content:center; gap:10px; width:100%; cursor:pointer;
  background:#fff; color:#1f2433; border:1px solid #dadce0; border-radius:var(--radius-sm); padding:11px 16px;
  font-size:15px; font-weight:600; font-family:inherit; }
.gbtn:hover { background:#f7f8fa; box-shadow:0 1px 3px rgba(20,25,50,.12); }
.gbtn svg { width:18px; height:18px; }
.login-note { font-size:12.5px; color:var(--text-faint); margin-top:14px; line-height:1.7; text-align:center; }
.access-card { text-align:center; }
.access-card .ic { font-size:34px; margin-bottom:6px; }
.spinner { width:34px; height:34px; border:3px solid var(--border); border-top-color:var(--primary); border-radius:50%; animation:spin .8s linear infinite; margin:30px auto; }
@keyframes spin { to { transform:rotate(360deg); } }
.center-screen { min-height:60vh; display:flex; align-items:center; justify-content:center; }

/* ---------- sortable headers & permissions table ---------- */
th.sortable { cursor:pointer; user-select:none; white-space:nowrap; }
th.sortable:hover { color:var(--text); }
.sarr { font-size:10px; opacity:.45; margin-left:2px; }
.sarr.on { opacity:1; color:var(--primary); }
.perm-table th, .perm-table td { font-size:13.5px; }
.perm-table input[type=checkbox] { width:17px; height:17px; cursor:pointer; accent-color:var(--primary); }

/* ---------- brand logo images ---------- */
.login-card .logo .logo-img-lg { width:48px; height:48px; border-radius:11px; display:block; box-shadow:0 1px 3px rgba(20,25,50,.15); }
.topbar .brand .logo-img { width:34px; height:34px; border-radius:8px; display:block; }

/* ---------- candidate inline status ---------- */
.cand select.cstage { border:1px solid var(--border); border-radius:7px; padding:5px 9px; font-size:13px; font-family:inherit; background:var(--surface); color:var(--text); }
.cand select.cstage:focus { outline:none; border-color:var(--primary); }

/* ---------- dashboard number lists ---------- */
.numrows { display:flex; flex-direction:column; }
.numrow { display:flex; justify-content:space-between; align-items:center; padding:9px 0; border-bottom:1px solid var(--border); font-size:14px; }
.numrow:last-child { border-bottom:none; }
.numrow .nl { color:var(--text-soft); }
.numrow .nv { font-weight:700; font-size:17px; letter-spacing:-.3px; }
