/* =========================================================
   Sintia Recruitment — shared design system
   ========================================================= */

:root {
  --purple-50: #f9f7ff;
  --purple-100: #e4dffd;
  --purple-500: #7960f4;
  --purple-600: #6247e0;
  --purple-700: #4f37c2;
  --purple-900: #2c1f6b;

  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-300: #b3b3b3;
  --ink-100: #f4f4f5;
  --ink-50: #fafafa;

  --green-500: #28bb65;
  --green-100: #c6fbdc;
  --red-500: #eb5757;
  --red-100: #ffefef;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --amber-500: #d97706;
  --amber-100: #fef3c7;

  --border: #e5e7eb;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .08);
  --shadow-lg: 0 20px 48px rgba(44, 31, 107, .18);

  --sidebar-w: 248px;
  --topbar-h: 76px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--ink-900);
  background: var(--ink-50);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; border: none; background: none; padding: 0; margin: 0; color: inherit; text-align: inherit; }
input, select, textarea { font-family: inherit; }

img { max-width: 100%; display: block; }

/* ---------- Auth / login layout ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}
.auth-visual {
  background: linear-gradient(160deg, var(--purple-900), var(--purple-600) 60%, var(--purple-500));
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-visual::after {
  content: "";
  position: absolute;
  width: 420px; height: 420px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  right: -140px; bottom: -160px;
}
.auth-visual h2 { font-size: 30px; line-height: 1.35; max-width: 380px; margin: 0 0 12px; }
.auth-visual p { color: rgba(255,255,255,.75); max-width: 360px; line-height: 1.6; }
.auth-form-wrap {
  display: flex; align-items: center; justify-content: center; padding: 40px;
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 24px; margin: 18px 0 6px; }
.auth-card .sub { color: var(--ink-500); margin-bottom: 32px; font-size: 14px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink-700); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--purple-500); box-shadow: 0 0 0 3px var(--purple-100);
}
.field .hint { font-size: 12px; color: var(--ink-500); margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--purple-500); color: #fff; }
.btn-primary:hover { background: var(--purple-600); }
.btn-block { width: 100%; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--ink-700); }
.btn-outline:hover { border-color: var(--purple-500); color: var(--purple-600); }
.btn-ghost { background: transparent; color: var(--ink-700); }
.btn-ghost:hover { background: var(--ink-100); }
.btn-danger { background: #fff; border-color: var(--red-500); color: var(--red-500); }
.btn-danger:hover { background: var(--red-100); }
.btn-success { background: var(--green-500); color: #fff; }
.btn-success:hover { filter: brightness(.95); }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: #fff;
  border-right: 1px solid var(--border); position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column; z-index: 20;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 22px 22px 16px; }
.sidebar-logo span { font-weight: 700; font-size: 19px; color: var(--purple-600); }
.sidebar-logo-img { height: 30px; width: auto; max-width: 100%; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 6px 12px 20px; }
.nav-group-label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--ink-300);
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--ink-700); margin-bottom: 2px; font-weight: 500;
}
.nav-item .ic { width: 18px; height: 18px; flex-shrink: 0; opacity: .75; }
.nav-item:hover:not(.is-disabled) { background: var(--ink-100); }
.nav-item.is-active { background: var(--purple-100); color: var(--purple-700); font-weight: 600; }
.nav-item.is-active .ic { opacity: 1; }
.nav-item.is-disabled { color: var(--ink-300); cursor: default; }
.nav-group { display: flex; flex-direction: column; }
.nav-group > .nav-item { justify-content: space-between; }
.nav-group > .nav-item .chev { transition: transform .15s; opacity: .5; }
.nav-group.is-open > .nav-item .chev { transform: rotate(180deg); }
.nav-sub { padding-left: 30px; display: none; }
.nav-group.is-open .nav-sub { display: block; }
.nav-sub .nav-item { font-size: 13px; padding: 8px 12px; }

.main {
  margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column;
}
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar h1 .wave { display: inline-block; }
.topbar .user { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--purple-100);
  color: var(--purple-700); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.user-meta { line-height: 1.3; }
.user-meta .name { font-weight: 600; font-size: 14px; }
.user-meta .role { font-size: 12px; color: var(--ink-500); }

.content { padding: 28px 32px 60px; flex: 1; }
.content-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.content-head h2 { font-size: 19px; margin: 0; }
.crumbs { font-size: 13px; color: var(--ink-500); margin-bottom: 6px; }
.crumbs a:hover { color: var(--purple-600); }

/* ---------- Cards / KPI ---------- */
.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .kpi-grid { grid-template-columns: 1fr; } }
.kpi-card { padding: 20px 22px; }
.kpi-card .top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kpi-icon {
  width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
}
.kpi-card .val { font-size: 26px; font-weight: 700; }
.kpi-card .label { font-size: 13px; color: var(--ink-500); margin-top: 2px; }
.kpi-card .delta { font-size: 12px; font-weight: 600; }
.delta.up { color: var(--green-500); }
.delta.down { color: var(--red-500); }

.two-col { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }

.panel-head {
  display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-body { padding: 18px 20px; }

.activity-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--ink-100); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--purple-500); }
.activity-item .t { font-size: 13.5px; font-weight: 500; }
.activity-item .d { font-size: 12px; color: var(--ink-500); margin-top: 2px; }

/* ---------- Table ---------- */
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px; flex-wrap: wrap;
}
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 340px; }
.search-box input {
  width: 100%; padding: 10px 14px 10px 38px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13.5px;
}
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: .45; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.select-sm {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; background: #fff;
}

.table-scroll { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table thead th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--ink-500); background: var(--ink-50); padding: 12px 16px; border-bottom: 1px solid var(--border);
  white-space: nowrap; cursor: pointer; user-select: none;
}
.data-table thead th:hover { color: var(--purple-600); }
.data-table thead th .arrow { opacity: .4; margin-left: 4px; font-size: 10px; }
.data-table tbody td {
  padding: 14px 16px; font-size: 13.5px; border-bottom: 1px solid var(--ink-100); vertical-align: middle; white-space: nowrap;
}
.data-table tbody tr:hover { background: var(--purple-50); }
.data-table tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; }
.cell-muted { color: var(--ink-500); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
}
.badge-purple { background: var(--purple-100); color: var(--purple-700); }
.badge-green { background: var(--green-100); color: #1b7a45; }
.badge-red { background: var(--red-100); color: #c53030; }
.badge-amber { background: var(--amber-100); color: #92600a; }
.badge-blue { background: var(--blue-100); color: #1d4ed8; }
.badge-gray { background: var(--ink-100); color: var(--ink-500); }

.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink-100); color: var(--ink-700); border: none;
}
.icon-btn:hover { background: var(--purple-100); color: var(--purple-700); }

.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 16px 20px; }
.page-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--ink-700);
}
.page-btn.is-active { background: var(--purple-500); border-color: var(--purple-500); color: #fff; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-500); }
.empty-state svg { margin-bottom: 14px; opacity: .5; }

/* ---------- Forms (job posting) ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .field.full { grid-column: 1 / -1; }
.section-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.section-desc { font-size: 13px; color: var(--ink-500); margin: 0 0 18px; }
.form-section { padding: 24px 26px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 26px; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--purple-50); border-radius: var(--radius-sm); }
.toggle-row .t-title { font-size: 13.5px; font-weight: 600; }
.toggle-row .t-desc { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--ink-300); border-radius: 999px; transition: .2s; }
.switch .track::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .track { background: var(--purple-500); }
.switch input:checked + .track::before { transform: translateX(18px); }

/* ---------- Candidate list / score ---------- */
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); font-size: 12.5px; font-weight: 600;
  color: var(--ink-700); background: #fff;
}
.chip.is-active { background: var(--purple-500); border-color: var(--purple-500); color: #fff; }

.score-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.score-ring {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.score-top { background: conic-gradient(var(--green-500) var(--pct,90%), var(--ink-100) 0); }
.score-good { background: conic-gradient(var(--blue-500) var(--pct,70%), var(--ink-100) 0); }
.score-low { background: conic-gradient(var(--amber-500) var(--pct,40%), var(--ink-100) 0); }
.score-ring .inner {
  width: 27px; height: 27px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; color: var(--ink-900);
}

.candidate-card {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--ink-100);
}
.candidate-card:hover { background: var(--purple-50); }
.candidate-card:last-child { border-bottom: none; }
.candidate-card .meta { flex: 1; min-width: 0; }
.candidate-card .cname { font-weight: 600; font-size: 14.5px; }
.candidate-card .csub { font-size: 12.5px; color: var(--ink-500); margin-top: 2px; }
.candidate-card .ctags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- Candidate detail ---------- */
.profile-head { display: flex; align-items: center; gap: 18px; padding: 24px 26px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.profile-head .avatar-lg {
  width: 66px; height: 66px; border-radius: 50%; background: var(--purple-100); color: var(--purple-700);
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; flex-shrink: 0;
}
.profile-head .name { font-size: 19px; font-weight: 700; }
.profile-head .role { font-size: 13.5px; color: var(--ink-500); margin-top: 2px; }
.profile-head .contact-row { display: flex; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
.profile-head .contact-row span { font-size: 12.5px; color: var(--ink-500); display: flex; align-items: center; gap: 5px; }
.profile-head .spacer { flex: 1; }
.profile-head .actions { display: flex; gap: 10px; }

.match-bar-row { margin-bottom: 16px; }
.match-bar-row:last-child { margin-bottom: 0; }
.match-bar-row .mb-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.match-bar-row .mb-top .label { font-weight: 600; color: var(--ink-700); }
.match-bar-row .mb-top .pct { font-weight: 700; color: var(--purple-600); }
.match-bar-track { height: 8px; border-radius: 999px; background: var(--ink-100); overflow: hidden; }
.match-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--purple-500), var(--blue-500)); }

.ai-summary-box {
  background: var(--purple-50); border: 1px solid var(--purple-100); border-radius: var(--radius-sm);
  padding: 14px 16px; font-size: 13px; color: var(--purple-900); line-height: 1.6; display: flex; gap: 10px;
}

.stepper { display: flex; align-items: flex-start; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; }
.step .dot {
  width: 30px; height: 30px; border-radius: 50%; background: var(--ink-100); color: var(--ink-500);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; z-index: 1; border: 3px solid #fff;
}
.step .line {
  position: absolute; top: 15px; left: 50%; width: 100%; height: 2px; background: var(--ink-100); z-index: 0;
}
.step:last-child .line { display: none; }
.step .lbl { font-size: 11.5px; margin-top: 8px; color: var(--ink-500); max-width: 90px; }
.step.is-done .dot { background: var(--green-500); color: #fff; }
.step.is-done .line { background: var(--green-500); }
.step.is-current .dot { background: var(--purple-500); color: #fff; box-shadow: 0 0 0 4px var(--purple-100); }
.step.is-current .lbl { color: var(--purple-700); font-weight: 600; }
.step.is-done .lbl { color: var(--ink-700); }

.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 20px; }
.tab-btn { padding: 14px 16px; font-size: 13.5px; font-weight: 600; color: var(--ink-500); border: none; background: none; border-bottom: 2px solid transparent; }
.tab-btn.is-active { color: var(--purple-600); border-color: var(--purple-500); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ---------- Utility ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.mt-0 { margin-top: 0; }
.text-muted { color: var(--ink-500); }
.section-gap { margin-bottom: 22px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 999px; }

/* ---------- Tia chatbot widget ---------- */
#tia-fab {
  position: fixed; right: 26px; bottom: 26px; width: 56px; height: 56px; border-radius: 50%;
  background: var(--purple-500); border: none; box-shadow: var(--shadow-lg); z-index: 60;
  display: flex; align-items: center; justify-content: center;
}
#tia-fab:hover { background: var(--purple-600); }
.tia-panel {
  position: fixed; top: 0; right: -400px; width: 380px; max-width: 92vw; height: 100vh; background: #fff;
  box-shadow: -12px 0 40px rgba(15,23,42,.18); z-index: 70; display: flex; flex-direction: column;
  transition: right .25s ease;
}
.tia-panel.is-open { right: 0; }
.tia-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.tia-head-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.tia-spark { color: var(--purple-500); }
.tia-close { background: none; border: none; font-size: 22px; line-height: 1; color: var(--ink-500); }
.tia-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.tia-greet { text-align: center; padding: 18px 8px 6px; }
.tia-spark-lg { font-size: 30px; color: var(--purple-500); margin-bottom: 8px; }
.tia-greet h4 { margin: 0 0 6px; font-size: 16px; }
.tia-greet p { margin: 0; font-size: 13px; color: var(--ink-500); }
.tia-msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; }
.tia-msg-bot { background: var(--ink-100); align-self: flex-start; border-bottom-left-radius: 4px; }
.tia-msg-user { background: var(--purple-500); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.tia-prompts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 14px; }
.tia-chip { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--purple-100); background: var(--purple-50); color: var(--purple-700); font-size: 12px; font-weight: 600; }
.tia-chip:hover { background: var(--purple-100); }
.tia-input-row { display: flex; gap: 8px; padding: 0 18px 12px; }
.tia-input-row input { flex: 1; padding: 11px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 13.5px; }
.tia-input-row input:focus { outline: none; border-color: var(--purple-500); }
.tia-send { width: 38px; height: 38px; border-radius: 50%; background: var(--purple-500); border: none; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tia-disclaimer { font-size: 10.5px; color: var(--ink-300); text-align: center; padding: 0 18px 14px; }
