:root {
    --navy: #0b3a75; --navy-2: #0a2f60; --blue: #1665c1; --orange: #f57c1f; --red: #e2431f;
    --bg: #f3f6fb; --card: #fff; --text: #16223a; --muted: #6b778c; --line: #e6ebf3;
    --sidebar-w: 240px; --radius: 12px;
    --t-blue: #e3efff; --t-blue-i: #1665c1; --t-green: #e1f6e8; --t-green-i: #1f9d55;
    --t-orange: #ffeadb; --t-orange-i: #f57c1f; --t-purple: #ece8fb; --t-purple-i: #6b4fd6;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
img { max-width: 100%; height: auto; }
h1, h2, p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 12px; height: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; background: none; color: var(--text); border-radius: 10px; cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--line); }

/* ---------- Sidebar ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: linear-gradient(180deg, var(--navy), var(--navy-2)); color: #fff; display: flex; flex-direction: column; z-index: 40; overflow-y: auto; }
.brand { background: #fff; padding: 10px 12px; display: flex; align-items: center; justify-content: center; height: 88px; }
.brand img { max-height: 68px; width: auto; object-fit: contain; }
.drawer-close { display: none; color: var(--navy); position: absolute; right: 8px; top: 8px; }
.sidebar nav { padding: 14px 12px; display: grid; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 8px; color: #e8f0fb; font-weight: 500; }
.nav-link:hover { background: rgba(255, 255, 255, .1); }
.nav-link.is-active { background: var(--blue); color: #fff; }
.nav-link .chev { margin-left: auto; width: 16px; height: 16px; opacity: .7; }
.tagline { margin-top: auto; padding: 24px; font-size: 18px; line-height: 1.35; color: #cfe0f7; }

/* ---------- Shell / topbar ---------- */
.shell { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.menu-btn, .topbar-logo, .search-btn { display: none; }
.search { flex: 1; display: flex; align-items: center; gap: 10px; max-width: 640px; background: #eef2f8; border-radius: 10px; padding: 0 14px; color: var(--muted); }
.search input { flex: 1; border: 0; background: none; padding: 12px 0; font: inherit; color: var(--text); outline: none; min-width: 0; }
.bell { margin-left: auto; }
.badge { position: absolute; top: 3px; right: 3px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; }
.profile { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.who { display: grid; line-height: 1.2; }
.who small { color: var(--muted); }
.ico.who { width: 16px; height: 16px; }

/* ---------- Content ---------- */
.content { padding: 24px; display: grid; gap: 20px; }
.welcome { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.welcome h1 { font-size: 24px; }
.welcome p { color: var(--muted); margin-top: 2px; }
.date { color: var(--text); white-space: nowrap; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 1px 3px rgba(16, 40, 80, .06); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 8px; }
.card-head h2 { font-size: 17px; }
.card-head a { font-size: 13px; }
.select { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; font-size: 12px; color: var(--muted); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); }
.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: #fff; flex: none; }
.stat-icon .ico { width: 26px; height: 26px; }
.stat-label { font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.delta { font-size: 12px; font-weight: 600; color: var(--t-green-i); display: inline-flex; align-items: center; gap: 2px; }
.stat-vs { font-size: 12px; color: var(--muted); }
.tone-blue { background: var(--t-blue); color: var(--t-blue-i); }
.tone-green { background: var(--t-green); color: var(--t-green-i); }
.tone-orange { background: var(--t-orange); color: var(--t-orange-i); }
.tone-purple { background: var(--t-purple); color: var(--t-purple-i); }
.stat .stat-label, .stat .stat-value { color: var(--text); }
.stat .stat-vs { color: var(--muted); }
.stat .delta { color: var(--t-green-i); }

/* funnel */
.funnel-row { display: grid; grid-template-columns: 90px 52px 1fr 44px; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; }
.f-label { font-weight: 500; }
.f-count { font-weight: 600; text-align: right; }
.f-pct { color: var(--muted); text-align: right; }
.bar { appearance: none; -webkit-appearance: none; width: 100%; height: 14px; border: 0; border-radius: 4px; background: #eef2f8; overflow: hidden; }
.bar::-webkit-progress-bar { background: #eef2f8; border-radius: 4px; }
.bar::-webkit-progress-value { border-radius: 4px; }
.bar-blue::-webkit-progress-value { background: #2d8cf0; } .bar-blue::-moz-progress-bar { background: #2d8cf0; }
.bar-sky::-webkit-progress-value { background: #7bb8f5; } .bar-sky::-moz-progress-bar { background: #7bb8f5; }
.bar-peach::-webkit-progress-value { background: #f9c49a; } .bar-peach::-moz-progress-bar { background: #f9c49a; }
.bar-green::-webkit-progress-value { background: #2bb673; } .bar-green::-moz-progress-bar { background: #2bb673; }

/* donut */
.status { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; justify-content: center; }
.donut { width: 190px; height: 190px; flex: none; }
.seg { transition: opacity .2s; }
.seg-blue { stroke: #2d8cf0; background: #2d8cf0; }
.seg-orange { stroke: #f57c1f; background: #f57c1f; }
.seg-yellow { stroke: #f7b731; background: #f7b731; }
.seg-green { stroke: #2bb673; background: #2bb673; }
.seg-grey { stroke: #aeb8c8; background: #aeb8c8; }
.donut-n { font-size: 6.5px; font-weight: 700; text-anchor: middle; fill: var(--text); }
.donut-t { font-size: 2.6px; text-anchor: middle; fill: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 190px; }
.legend li { display: flex; align-items: center; gap: 10px; }
.legend b { margin-left: auto; padding-left: 24px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* interviews */
.interview { display: grid; grid-template-columns: 46px 74px 1.2fr 1fr auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.interview:first-of-type { border-top: 0; }
.cal { display: grid; place-items: center; background: var(--t-blue); color: var(--blue); border-radius: 8px; padding: 4px 0; font-size: 10px; font-weight: 600; line-height: 1.1; }
.cal b { font-size: 16px; }
.who-role { display: grid; } .who-role small, .company { color: var(--muted); }
.pill { display: inline-block; padding: 3px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; border: 1px solid transparent; white-space: nowrap; }
.mode-video { background: #e3f0ff; color: #1665c1; border-color: #b9d7fa; }
.mode-in-person { background: #e7effb; color: #1665c1; border-color: #a9c4ee; }
.mode-phone { background: #ece8fb; color: #6b4fd6; border-color: #cfc5f4; }

/* activity */
.activity { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 9px 0; font-size: 13px; }
.a-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.a-icon .ico { width: 18px; height: 18px; }
.a-text { display: grid; min-width: 0; } .a-text small, .activity time { color: var(--muted); font-size: 12px; }
.a-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* jobs table */
.jobs { width: 100%; border-collapse: collapse; font-size: 13px; }
.jobs th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px 10px; background: #f7f9fc; }
.jobs td { padding: 12px 10px; border-top: 1px solid var(--line); }
.jobs td:first-child a { font-weight: 600; }
.st-open { background: #e3f0ff; color: #1665c1; border-radius: 999px; padding: 3px 14px; }
.st-interviewing { background: #ffeadb; color: #d8620c; border-radius: 999px; padding: 3px 14px; }
.st-on-hold { background: #fff1cf; color: #b7791f; border-radius: 999px; padding: 3px 14px; }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.foot a { color: var(--muted); padding: 0 6px; }

/* ---------- Bottom tab bar (tablet + mobile) ---------- */
.tabbar { display: none; }
.backdrop { display: none; }

/* ---------- Tablet ---------- */
@media (max-width: 1023px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: 4px 0 24px rgba(0, 0, 0, .25); }
    .brand { position: relative; }
    .drawer-close { display: grid; }
    .drawer-open .sidebar { transform: none; }
    .backdrop { display: block; position: fixed; inset: 0; background: rgba(8, 20, 44, .5); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 35; }
    .drawer-open .backdrop { opacity: 1; pointer-events: auto; }
    .shell { margin-left: 0; padding-bottom: 72px; }
    .topbar { padding: 10px 16px; }
    .menu-btn, .topbar-logo, .search-btn { display: inline-grid; }
    .topbar-logo { display: block; }
    .topbar-logo img { height: 52px; width: auto; display: block; }
    .search { display: none; }
    .search-btn { margin-left: auto; }
    .bell { margin-left: 0; }
    .profile { padding-left: 0; border: 0; }
    .profile .who { display: none; }
    .content { padding: 18px 16px; }
    .stats { grid-template-columns: 1fr 1fr; }
    .grid.two { grid-template-columns: 1fr; }
    .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
    .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; font: inherit; font-size: 11px; color: var(--muted); background: none; border: 0; padding: 4px 0; cursor: pointer; }
    .tabbar .is-active { color: var(--blue); font-weight: 600; }
}

/* ---------- Mobile ---------- */
@media (max-width: 639px) {
    .topbar-logo img { height: 44px; }
    .search-btn { display: none; }
    .topbar { gap: 4px; }
    .bell { margin-left: auto; }
    .welcome { flex-direction: column; }
    .welcome h1 { font-size: 20px; }
    .date { display: none; }
    .stats { grid-template-columns: 1fr; gap: 10px; }
    .stat { padding: 12px 16px; }
    .stat-icon { width: 44px; height: 44px; }
    .stat-value { font-size: 24px; }
    .card { padding: 16px; }
    .funnel-row { grid-template-columns: 78px 44px 1fr 38px; gap: 6px; font-size: 12px; }
    .status { flex-direction: column; gap: 16px; }
    .legend { width: 100%; }
    .interview { grid-template-columns: 44px 1fr auto; grid-template-areas: "cal who mode" "cal time company"; row-gap: 2px; }
    .cal { grid-area: cal; } .who-role { grid-area: who; } .pill { grid-area: mode; } .time { grid-area: time; color: var(--muted); } .company { grid-area: company; text-align: right; }
    .activity { grid-template-columns: 40px 1fr; }
    .activity time { grid-column: 2; }
    .jobs thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .jobs, .jobs tbody, .jobs tr, .jobs td { display: block; }
    .jobs tr { border-top: 1px solid var(--line); padding: 10px 0; position: relative; }
    .jobs td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; }
    .jobs td::before { content: attr(data-label); color: var(--muted); }
    .jobs td.act { position: absolute; top: 4px; right: -8px; padding: 0; }
    .jobs td.act::before { content: none; }
    .jobs td:first-child { padding-right: 32px; }
    .foot { flex-direction: column; text-align: center; align-items: center; }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .backdrop { transition: none; } }

/* ---------- Forms, flashes, buttons (shared by Users + login) ---------- */
.logout { margin: 0; }
.flash { margin: 0; padding: 10px 14px; border-radius: 8px; font-size: 13px; list-style: none; }
.flash.ok { background: var(--t-green); color: #14703c; }
.flash.err { background: #fde8e4; color: #a3200a; }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 500; font-size: 13px; }
.field > input, .field > select, .field > textarea, .input { border: 1px solid var(--line); background: #fff; border-radius: 10px; font: inherit; color: var(--text); }
.field > input { padding: 11px 12px; }
.input { display: flex; align-items: center; gap: 10px; padding: 0 12px; color: var(--muted); }
.input input { flex: 1; min-width: 0; border: 0; background: none; padding: 11px 0; font: inherit; color: var(--text); outline: none; }
.field > input:focus, .input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22, 101, 193, .15); }
.field-error { color: #b00020; font-size: 12px; min-height: 0; }
.btn { border: 0; border-radius: 10px; background: var(--blue); color: #fff; font: inherit; font-weight: 600; padding: 12px 16px; cursor: pointer; }
.btn:hover { background: var(--navy); }

/* ---------- Login ---------- */
.auth-page { background: var(--navy); }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-aside { background: linear-gradient(160deg, var(--navy) 0%, #0f5aa8 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 28px; }
.auth-slogan { font-size: 40px; font-weight: 700; font-style: italic; line-height: 1.15; }
.auth-slogan::after { content: ""; display: block; width: 56px; height: 4px; background: var(--orange); border-radius: 2px; margin-top: 14px; }
.auth-words { font-size: 22px; line-height: 1.6; color: #cfe0f7; }
.auth-tag { margin-top: auto; font-weight: 600; }
.auth-main { background: var(--bg); display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 28px 28px 20px; box-shadow: 0 8px 32px rgba(16, 40, 80, .12); display: grid; gap: 12px; }
.auth-logo { width: 200px; max-width: 70%; height: auto; justify-self: center; }
.auth-card h1 { font-size: 22px; text-align: center; }
.auth-sub { color: var(--muted); text-align: center; margin-bottom: 4px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 6px; }
@media (max-width: 899px) {
    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-page { background: var(--bg); }
    .auth-main { min-height: 100vh; }
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.pagination { list-style: none; display: flex; gap: 8px; justify-content: flex-end; margin: 14px 0 0; padding: 0; }
.pagination a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; }
.pagination .active a { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---------- Admin users + permission profiles ---------- */
.select { border: 1px solid var(--line); background: #fff; border-radius: 10px; font: inherit; color: var(--text); padding: 11px 12px; }
.hint { color: #6b7a90; font-size: 12px; }
.row-actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.row-actions form { margin: 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.table-scroll { overflow-x: auto; }
.perm-matrix th[scope="row"] { text-align: left; font-weight: 500; }
.perm-matrix .perm-module th { background: #f3f6fb; text-align: left; font-size: 13px; }
.perm-matrix input[type="checkbox"] { width: 18px; height: 18px; }
form.form > .card + .card, form.form > .card + .btn { margin-top: 16px; }
[hidden] { display: none !important; }

/* ---------- Candidates ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.field > textarea { padding: 11px 12px; resize: vertical; }
.field > input:disabled { background: #f3f6fb; color: var(--muted); }
.field > input:focus-visible, .field > select:focus-visible, .field > textarea:focus-visible, .select:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.field .select { width: 100%; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; font-size: 13px; }
.inline-pair { display: grid; grid-template-columns: 1fr 90px; gap: 8px; }
.inline-pair input { border: 1px solid var(--line); background: #fff; border-radius: 10px; font: inherit; color: var(--text); padding: 11px 12px; min-width: 0; }
.repeat-row { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.repeat-row + .repeat-row { border-top: 1px dashed var(--line); padding-top: 12px; }
.loc-row { grid-template-columns: repeat(4, 1fr) auto; align-items: end; gap: 8px; }
.loc-row .field { display: grid; gap: 4px; min-width: 0; }
.loc-row input, .loc-row select { border: 1px solid var(--line); border-radius: 10px; font: inherit; padding: 11px 12px; min-width: 0; width: 100%; }
.loc-row .link-btn { align-self: center; }
.loc-head { border: 0; padding: 0 0 4px; margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.repeat-row .link-btn { justify-self: start; }
.geo-group { display: contents; }
.permanent-toggle { margin-top: 14px; }
.section-sub { grid-column: 1 / -1; margin: 4px 0 -4px; font-size: 14px; color: var(--muted); }
@media (max-width: 720px) { .loc-row { grid-template-columns: 1fr; align-items: stretch; } .loc-head { display: none; } }
.link-btn.danger { color: #b00020; }
.list-search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.list-search .select { min-width: 220px; }
.list-search .btn { padding: 10px 14px; }
.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 20px; margin: 0; }
.details dt { color: var(--muted); font-size: 12px; }
.details dd { margin: 2px 0 0; overflow-wrap: anywhere; }
main.content > form.form > .card, main.content > .card { margin-bottom: 16px; }
@media (max-width: 640px) { .list-search { width: 100%; } .list-search .select { flex: 1; min-width: 0; } }

/* ---------- Pagination ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: 14px; }
.pager-info { margin: 0; color: var(--muted); font-size: 13px; }
.pager ul { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; flex-wrap: wrap; }
.pg { display: inline-block; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; color: var(--blue); text-decoration: none; }
a.pg:hover { background: #eef4fc; }
.pg.is-current { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.pg.is-disabled { color: #9aa7b8; background: #f6f8fb; cursor: not-allowed; }
