:root {
  --accent: #1F3A5F;
  --accent-soft: #e8eef6;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #6b6f76;
  --border: #e2e4e8;
  --danger: #b42318;
  --ok: #2e7d32;
  --radius: 10px;
  --s-applied: #1F3A5F;
  --s-info_requested: #b26a00;
  --s-interviewed: #6941c6;
  --s-accepted: #2e7d32;
  --s-rejected: #8a8f98;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 20px; }
h3 { font-size: 16px; margin-bottom: 10px; }
.hidden { display: none !important; }
.muted { color: var(--muted); margin: 2px 0 0; }
.small { font-size: 13px; }
.brand { font-weight: 700; color: var(--accent); font-size: 20px; letter-spacing: -0.2px; }

/* buttons & inputs */
.btn { border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 9px 14px;
  border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: #c4c8cf; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #2a4b77; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 14px; }
.btn.full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .6; cursor: wait; }
.link { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; margin-top: 14px; padding: 0; }
input, select, textarea { width: 100%; font: inherit; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text); margin-top: 4px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b8c8de; border-color: var(--accent); }
label { display: block; font-weight: 500; font-size: 14px; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.msg { min-height: 0; margin: 6px 0; font-size: 14px; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: var(--card); padding: 28px; border-radius: 14px; width: 100%; max-width: 380px; border: 1px solid var(--border); }
.auth-card form { display: grid; gap: 12px; margin-top: 18px; }

/* layout */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; padding: 10px 20px;
  background: var(--card); border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab { background: none; border: none; font: inherit; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 500; }
.tab.active { background: var(--accent-soft); color: var(--accent); }
main { max-width: 1280px; margin: 0 auto; padding: 20px; }
.view-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.bottom-nav { display: none; }

/* job cards */
.filters { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.filter-input { max-width: 280px; margin: 0; }
.chip { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card h4 { margin: 0; font-size: 15px; font-weight: 600; }
.meta { color: var(--muted); font-size: 13px; }
.score { flex-shrink: 0; font-weight: 700; font-size: 13px; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.score.high { background: #e3f2e5; color: var(--ok); }
.score.low { background: #f1f1f3; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 12px; background: #f1f1f3; border-radius: 6px; padding: 2px 7px; color: #444; }
.source { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); background: var(--card); border: 1px dashed var(--border); border-radius: var(--radius); }

/* tracker */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 13px; color: var(--muted); }
.stage-tabs { display: none; }
.board { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; align-items: start; }
.column { background: #eceef1; border-radius: var(--radius); padding: 10px; min-height: 160px; }
.column.drag-over { outline: 2px dashed var(--accent); }
.column-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.column-head .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.count { background: #fff; border-radius: 999px; padding: 0 8px; font-size: 13px; }
.app-card { background: var(--card); border-radius: 8px; padding: 10px; margin-bottom: 8px; border: 1px solid var(--border);
  border-left: 4px solid var(--stage-color, var(--accent)); cursor: grab; }
.app-card:active { cursor: grabbing; }
.app-card h5 { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
.app-card .meta a { color: var(--accent); }

/* admin */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { max-width: 300px; margin: 0; }
.list { margin-top: 10px; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #f1f1f3; color: var(--muted); }
.badge.ok { background: #e3f2e5; color: var(--ok); }

/* CV upload */
.upload-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.label-text { font-weight: 500; font-size: 14px; }
.upload-btn { font-weight: 500; }

/* forms */
.form { display: grid; gap: 14px; max-width: 760px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checks { display: grid; gap: 6px; align-content: end; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: auto; margin: 0; }

dialog { border: none; border-radius: 14px; padding: 20px; width: min(520px, 94vw); }
dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog-actions { display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #222; color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 50; max-width: 90vw; }

/* ---------- mobile ---------- */
@media (max-width: 800px) {
  .topbar .tabs { display: none; }
  .topbar { justify-content: space-between; padding: 10px 14px; }
  main { padding: 14px 14px 90px; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
  .bottom-nav .tab { flex: 1; padding: 10px 4px; font-size: 13px; }
  .view-head { flex-direction: column; }
  .view-head .btn { width: 100%; justify-content: center; }
  .cards { grid-template-columns: 1fr; }
  .filter-input { max-width: none; flex: 1 1 100%; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 2px; }
  .stage-tabs .chip { white-space: nowrap; }
  .board { display: block; }
  .column { display: none; background: none; padding: 0; }
  .column.mobile-active { display: block; }
  .column-head { display: none; }
  .row { grid-template-columns: 1fr; }
  .app-card { cursor: pointer; }
}

/* ---------- tailored CV ---------- */
#cv-view { position: fixed; inset: 0; background: var(--bg); z-index: 40; overflow-y: auto; }
.cv-toolbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--border); }
.cv-title { font-weight: 600; font-size: 14px; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-lang { width: auto; margin: 0; padding: 6px 8px; }
.cv-layout { display: grid; grid-template-columns: minmax(0, 210mm) minmax(240px, 340px); gap: 20px; justify-content: center; padding: 20px; }
.cv-page { background: #fff; width: 100%; min-height: 297mm; padding: 16mm 15mm; box-shadow: 0 2px 12px rgba(0,0,0,.08);
  border-radius: 4px; font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; font-size: 10.5pt; line-height: 1.38; color: #1c1c1e; outline: none; }
.cv-page:focus { box-shadow: 0 0 0 2px #b8c8de; }
.cv-page h1 { font-size: 20pt; color: #1F3A5F; margin: 0; }
.cv-page .cv-headline { font-style: italic; color: #555; margin: 2px 0 6px; }
.cv-page .cv-contact { font-size: 9.5pt; color: #333; margin: 0; }
.cv-page .cv-contact a { color: #1F3A5F; }
.cv-page h2 { font-size: 12pt; color: #1F3A5F; border-bottom: 1px solid #1F3A5F; padding-bottom: 2px; margin: 14px 0 6px; }
.cv-page .cv-entry { margin-bottom: 8px; break-inside: avoid; }
.cv-page .cv-row { display: flex; justify-content: space-between; gap: 10px; }
.cv-page .cv-row b { font-weight: 700; }
.cv-page .cv-dates { color: #555; white-space: nowrap; }
.cv-page .cv-sub { font-style: italic; color: #555; }
.cv-page ul { margin: 3px 0 0; padding-left: 18px; }
.cv-page li { margin-bottom: 1px; }
.cv-page p { margin: 0 0 4px; }
.cv-page .cv-skill b { font-weight: 700; }
.cv-notes { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; font-size: 14px; align-self: start; position: sticky; top: 70px; }
.cv-notes h4 { margin: 0 0 6px; font-size: 14px; }
.cv-notes ul { margin: 0 0 12px; padding-left: 18px; }
.cv-notes .gap { color: #b26a00; }
.cv-loading { text-align: center; padding: 120px 20px; color: var(--muted); font-family: inherit; }

@media (max-width: 900px) {
  .cv-layout { grid-template-columns: 1fr; padding: 10px; }
  .cv-page { min-height: 0; padding: 18px 16px; }
  .cv-notes { position: static; }
  .cv-title { max-width: 100%; flex-basis: 100%; order: -1; }
}

@media print {
  @page { size: A4; margin: 14mm 15mm; }
  html, body { background: #fff !important; }
  body > *:not(#cv-view) { display: none !important; }
  #cv-view { position: static; overflow: visible; background: #fff; }
  .cv-toolbar, .cv-notes, #cv-msg { display: none !important; }
  .cv-layout { display: block; padding: 0; }
  .cv-page { box-shadow: none; padding: 0; min-height: 0; width: auto; border-radius: 0; }
  .cv-page a { color: #1F3A5F; text-decoration: none; }
}
