:root {
  --navy: #0f1e3d;
  --navy-2: #172a52;
  --blue: #1e4fd8;
  --blue-d: #173fb0;
  --blue-l: #e8eefc;
  --green: #12805c;
  --green-l: #e3f5ee;
  --wa: #1fa855;
  --red: #c0352b;
  --red-l: #fdecea;
  --amber: #a86400;
  --amber-l: #fff4e0;
  --ink: #18202f;
  --ink-2: #4a5568;
  --ink-3: #8592a6;
  --line: #e3e8ef;
  --bg: #f4f6fa;
  --card: #fff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
.hidden { display: none !important; }
a { color: var(--blue); }
h1, h2, h3 { margin: 0; font-weight: 600; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: #f7f9fc; border-color: #cfd6e2; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-d); border-color: var(--blue-d); }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-wa:hover { background: #188c46; border-color: #188c46; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-l); border-color: #f2c1bc; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn { border: 0; background: none; cursor: pointer; font-size: 16px; color: var(--ink-3); padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }

label { display: block; font-weight: 500; color: var(--ink-2); font-size: 13px; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid #d3dae5; border-radius: 8px; font: inherit; color: var(--ink); background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,79,216,.15); }
textarea { resize: vertical; min-height: 160px; line-height: 1.5; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; display: inline-block; accent-color: var(--blue); }
.form-error { color: var(--red); font-size: 13px; min-height: 18px; }
.hint { color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 14px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy) 0%, #1d3c7a 100%); padding: 20px; }
.login-card { background: #fff; width: 100%; max-width: 380px; padding: 32px; border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card h1 { font-size: 20px; margin: 22px 0 16px; }
.login-card label { margin-bottom: 14px; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 236px; background: var(--navy); color: #c9d3e8; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 20; }
.brand { display: flex; gap: 10px; align-items: center; padding: 20px 18px; }
.brand strong { display: block; color: #fff; font-size: 16px; }
.brand small { display: block; font-size: 11.5px; color: #8fa0c4; }
.brand-lg strong { color: var(--navy); font-size: 18px; }
.brand-lg small { color: var(--ink-3); }
.logo { width: 36px; height: 36px; border-radius: 9px; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; letter-spacing: .5px; }
nav { flex: 1; padding: 4px 10px; overflow-y: auto; }
nav a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 8px; color: #c9d3e8; text-decoration: none; cursor: pointer; margin-bottom: 2px; }
nav a i { font-style: normal; width: 18px; text-align: center; opacity: .8; }
nav a:hover { background: var(--navy-2); color: #fff; }
nav a.active { background: var(--blue); color: #fff; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #6f81a8; padding: 16px 12px 6px; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 4px; }
.sidebar-foot .btn { color: #c9d3e8; justify-content: flex-start; }
.sidebar-foot .btn:hover { background: var(--navy-2); color: #fff; }
.who { font-size: 13px; padding: 0 10px 6px; color: #fff; }
.who small { display: block; color: #8fa0c4; }

.main { flex: 1; margin-left: 236px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 16px 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar h2 { font-size: 18px; flex: 1; }
.menu-btn { display: none; font-size: 18px; }
.content { padding: 24px 28px 48px; max-width: 1280px; }

.pills { display: flex; gap: 8px; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--green-l); color: var(--green); border-color: #bfe5d4; }
.pill.warn { background: var(--amber-l); color: var(--amber); border-color: #f3d9a8; }

/* ---------- cards / tables ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h3 { font-size: 15px; flex: 1; }
.card-body { padding: 18px; }
.stat { padding: 18px; }
.stat .num { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat .lbl { color: var(--ink-3); font-size: 13px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-3); font-weight: 600; background: #fafbfd; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbff; }
td.actions { white-space: nowrap; text-align: right; }
td.chk, th.chk { width: 36px; padding-right: 0; }
.muted { color: var(--ink-3); }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.badge { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--ink-2); font-weight: 500; }
.badge.blue { background: var(--blue-l); color: var(--blue); }
.badge.green { background: var(--green-l); color: var(--green); }
.badge.red { background: var(--red-l); color: var(--red); }
.badge.amber { background: var(--amber-l); color: var(--amber); }
.search { max-width: 280px; margin: 0; }
td input { margin: 0; padding: 6px 8px; }

/* ---------- dropzone ---------- */
.drop { border: 2px dashed #c7d0de; border-radius: var(--radius); padding: 34px 20px; text-align: center; background: #fbfcfe; cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--blue); background: var(--blue-l); }
.drop strong { display: block; font-size: 15px; margin-bottom: 4px; }
.drop input { display: none; }

/* ---------- compose ---------- */
.compose { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.recips { max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.recip { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.recip:last-child { border-bottom: 0; }
.recip:hover { background: #fafbff; }
.recip .info { flex: 1; min-width: 0; }
.recip .info div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recip .info small { color: var(--ink-3); }
.recip.disabled { opacity: .45; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 3px 9px; background: var(--blue-l); color: var(--blue); border-radius: 99px; cursor: pointer; border: 0; font-family: inherit; }
.chip:hover { background: #d6e1fb; }
.preview { background: #fafbfd; border: 1px solid var(--line); border-radius: 8px; padding: 14px; white-space: pre-wrap; line-height: 1.55; font-size: 13.5px; max-height: 300px; overflow-y: auto; }
.preview .subj { font-weight: 600; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.wa-bubble { background: #dcf8c6; border-radius: 8px 8px 8px 2px; padding: 10px 12px; white-space: pre-wrap; line-height: 1.5; font-size: 13.5px; max-width: 100%; }
.progress { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--blue); width: 0; transition: width .3s; }

/* ---------- modal / toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,30,61,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-box.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { flex: 1; font-size: 16px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 13.5px; max-width: 360px; animation: slide .2s ease-out; }
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }

@media (max-width: 960px) {
  .compose, .g3, .g4 { grid-template-columns: 1fr 1fr; }
  .compose { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .pills { display: none; }
}

/* ================= Dashboard ================= */
:root {
  --c-blue: #2a78d6; --c-orange: #eb6834; --c-aqua: #1baf7a; --c-yellow: #eda100;
  --c-magenta: #e87ba4; --c-green: #008300; --c-violet: #6250d6; --c-red: #e34948;
}
.hero { position: relative; overflow: hidden; border-radius: 14px; padding: 24px 28px; color: #fff;
  background: linear-gradient(120deg, #0f1e3d 0%, #1e4fd8 55%, #6250d6 100%); display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.hero::after { content: ''; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero::before { content: ''; position: absolute; right: 120px; bottom: -110px; width: 200px; height: 200px; border-radius: 50%; background: rgba(27,175,122,.25); }
.hero h1 { font-size: 22px; }
.hero p { margin: 6px 0 0; color: #d6def5; }
.hero .row { position: relative; z-index: 1; margin-left: auto; }
.hero .btn { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.25); color: #fff; }
.hero .btn:hover { background: rgba(255,255,255,.24); }
.hero .btn.solid { background: #fff; color: var(--blue); border-color: #fff; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.kpi { position: relative; padding: 16px 16px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.kpi::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--k); }
.kpi .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 16px; color: var(--k); background: color-mix(in srgb, var(--k) 14%, #fff); }
.kpi .lbl { color: var(--ink-2); font-size: 12.5px; margin-top: 10px; }
.kpi .num { font-size: 26px; font-weight: 700; margin-top: 2px; letter-spacing: -.5px; }
.kpi .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.kpi .sub b { color: var(--ink); font-weight: 600; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.dash-grid.even { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--k); display: inline-block; }

.bars { position: relative; height: 200px; display: flex; align-items: flex-end; gap: 6px; padding: 0 2px; border-bottom: 1px solid #cfd6e2; }
.bars .grid-line { position: absolute; left: 0; right: 0; border-top: 1px dashed #edf0f5; font-size: 10.5px; color: var(--ink-3); }
.bars .grid-line span { position: absolute; left: 0; top: -14px; }
.bars .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; position: relative; z-index: 1; cursor: default; }
.bars .col:hover .seg { filter: brightness(1.08); }
.bars .col:hover { background: rgba(30,79,216,.04); border-radius: 6px 6px 0 0; }
.bars .seg { width: 100%; max-width: 26px; margin: 0 auto; background: var(--k); }
.bars .seg.top { border-radius: 4px 4px 0 0; }
.xlabels { display: flex; gap: 6px; padding: 6px 2px 0; font-size: 10.5px; color: var(--ink-3); }
.xlabels span { flex: 1; text-align: center; white-space: nowrap; }
.bars.small { height: 120px; }

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { position: relative; width: 150px; height: 150px; flex: none; }
.donut .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut .center b { font-size: 24px; }
.donut .center small { color: var(--ink-3); font-size: 11.5px; }
.donut-legend { display: grid; gap: 10px; flex: 1; min-width: 140px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--k); }
.donut-legend b { margin-left: auto; }
.donut-legend small { color: var(--ink-3); width: 38px; text-align: right; }

.meter { margin-bottom: 14px; }
.meter:last-child { margin-bottom: 0; }
.meter .top { display: flex; font-size: 13px; margin-bottom: 6px; }
.meter .top b { margin-left: auto; }
.meter .top small { color: var(--ink-3); margin-left: 6px; }
.meter .track { height: 8px; background: #eef1f6; border-radius: 99px; overflow: hidden; }
.meter .fill { height: 100%; border-radius: 99px; background: var(--k); }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 12px; flex: none; background: var(--k); }
.mini-list .grow { flex: 1; min-width: 0; }
@media (max-width: 760px) { .mini-list li > small { display: none; } .hero { padding: 20px; } .hero .row .btn { flex: 1 1 40%; } }
.mini-list .grow div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list small { color: var(--ink-3); }

.tip { position: fixed; z-index: 70; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 7px; box-shadow: 0 6px 18px rgba(0,0,0,.2); line-height: 1.5; white-space: nowrap; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--k); }

/* ================= CV box in candidate form ================= */
.cv-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px dashed #c7d0de; border-radius: 10px; background: #fbfcfe; margin-bottom: 16px; cursor: pointer; transition: .15s; }
.cv-box:hover, .cv-box.over { border-color: var(--blue); background: var(--blue-l); }
.cv-box.has { border-style: solid; border-color: #bfe5d4; background: var(--green-l); cursor: default; }
.cv-box .ico { width: 38px; height: 38px; border-radius: 9px; background: #fff; display: grid; place-items: center; font-size: 18px; border: 1px solid var(--line); flex: none; }
.cv-box .txt { flex: 1; min-width: 0; font-size: 13px; }
.cv-box .txt strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-box input { display: none; }
.filled { background: #fffbea !important; border-color: #f3d58a !important; }
.cv-link { border: 0; background: var(--blue-l); color: var(--blue); font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 99px; cursor: pointer; }
.cv-link:hover { background: #d6e1fb; }

@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 960px) { .dash-grid, .dash-grid.even, .dash-grid.two { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); } .hero .row { margin-left: 0; } }
