:root {
  --navy: #1F2A44;
  --navy-soft: #2e3d63;
  --ink: #1c2333;
  --muted: #6b7280;
  --bg: #f5f6f9;
  --card: #ffffff;
  --line: #e4e7ee;
  --green: #0f7b48;
  --green-bg: #e5f5ec;
  --amber: #92600a;
  --amber-bg: #fdf1dc;
  --red: #b3382e;
  --red-bg: #fdeae8;
  --blue: #1d4ed8;
  --blue-bg: #e7edfd;
  --grey-bg: #eef0f4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 28px;
  background: var(--navy); color: #fff;
  padding: 0 22px; height: 56px;
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: -.3px; color: #fff !important; text-decoration: none !important; }
.brand span { color: #8fb4ff; }
.brand-lg { font-size: 30px; color: var(--navy) !important; }
.brand-lg span { color: var(--blue); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: #cdd6ea; padding: 6px 12px; border-radius: 7px; font-weight: 500;
  text-decoration: none !important;
}
.topbar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.topbar nav a.on { background: rgba(255,255,255,.14); color: #fff; }
.topbar-actions { display: flex; gap: 8px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 8px;
  padding: 8px 15px; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none !important; transition: all .12s;
  background: #fff; color: var(--ink); border-color: var(--line);
}
.btn:hover { border-color: #c8cdd9; background: #fafbfd; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-soft); border-color: var(--navy-soft); }
.btn-green { background: var(--green); color: #fff; border-color: var(--green); }
.btn-green:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: #dbe3f3; border-color: rgba(255,255,255,.25); }
.btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.4); }
.btn-danger { color: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* ---------- layout ---------- */
main { max-width: 1220px; margin: 0 auto; padding: 26px 22px 80px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; letter-spacing: -.3px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- stat chips ---------- */
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 16px; box-shadow: var(--shadow); min-width: 108px;
}
.stat b { display: block; font-size: 20px; color: var(--navy); }
.stat span { font-size: 12.5px; color: var(--muted); }

/* ---------- filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 5px 13px; font-size: 13px; font-weight: 500; color: var(--muted);
  cursor: pointer; text-decoration: none !important;
}
.chip:hover { border-color: #c8cdd9; color: var(--ink); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.filters input[type="search"] {
  margin-left: auto; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; font-size: 14px; min-width: 220px;
}

/* ---------- job cards ---------- */
.job-list { display: flex; flex-direction: column; gap: 10px; }
.job-card {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 18px; box-shadow: var(--shadow);
  text-decoration: none !important; color: var(--ink);
  transition: border-color .12s, transform .12s;
}
.job-card:hover { border-color: #b9c2d8; transform: translateY(-1px); }
.score {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%;
  font-weight: 800; font-size: 16px; border: 2.5px solid;
}
.score-high { color: var(--green); border-color: var(--green); background: var(--green-bg); }
.score-mid { color: var(--amber); border-color: #d9a441; background: var(--amber-bg); }
.score-low { color: var(--muted); border-color: #c3c9d4; background: var(--grey-bg); }
.job-main h3 { margin: 0 0 2px; font-size: 16px; letter-spacing: -.2px; }
.job-meta { font-size: 13.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.job-meta .dot::before { content: "·"; margin-right: 6px; }
.job-side { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }

.pill {
  display: inline-block; border-radius: 999px; padding: 3px 11px;
  font-size: 12px; font-weight: 700; letter-spacing: .2px;
}
.pill-grey { background: var(--grey-bg); color: #4b5563; }
.pill-blue { background: var(--blue-bg); color: var(--blue); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-red { background: var(--red-bg); color: var(--red); }
.src { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1.5px 7px; background: #fff; }

/* ---------- detail page ---------- */
.detail-head { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 16px; }
.detail-head .row1 { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.detail-head h1 { font-size: 21px; margin: 0; letter-spacing: -.3px; }
.detail-cols { display: grid; grid-template-columns: minmax(340px, 46%) 1fr; gap: 16px; align-items: start; }
@media (max-width: 980px) { .detail-cols { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { padding: 13px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.panel-body { padding: 18px; }
.jd-text { white-space: pre-wrap; font-size: 14px; max-height: 72vh; overflow-y: auto; color: #333c4e; }
.jd-text mark { background: #fff3bf; border-radius: 3px; padding: 0 2px; }

.rationale { border-left: 3px solid var(--navy); background: #f8f9fc; padding: 12px 14px; border-radius: 0 8px 8px 0; margin-bottom: 14px; font-size: 14px; }
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { background: var(--green-bg); color: var(--green); border-radius: 5px; padding: 2px 8px; font-size: 12.5px; font-weight: 600; }
.tag.miss { background: var(--red-bg); color: var(--red); }
.tag.flag { background: var(--amber-bg); color: var(--amber); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; }
.tab {
  border: none; background: none; padding: 12px 14px; font-size: 14px; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px;
}
.tab.on { color: var(--navy); border-bottom-color: var(--navy); }
.tabpane { display: none; }
.tabpane.on { display: block; }

/* ---------- resume preview ---------- */
.resume-preview { font-size: 13.5px; color: #222; max-height: 62vh; overflow-y: auto; padding-right: 6px; }
.resume-preview h2 { text-align: center; color: var(--navy); margin: 4px 0 0; font-size: 19px; letter-spacing: 1px; }
.resume-preview .headline { text-align: center; font-style: italic; color: var(--muted); margin: 2px 0; }
.resume-preview .contact { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.resume-preview h3 {
  color: var(--navy); font-size: 12.5px; text-transform: uppercase; letter-spacing: .8px;
  border-bottom: 1px solid var(--line); padding-bottom: 3px; margin: 16px 0 7px;
}
.resume-preview ul { margin: 4px 0 10px; padding-left: 20px; }
.resume-preview li { margin-bottom: 3px; }
.resume-preview .role-line { font-weight: 700; margin-top: 9px; }
.resume-preview .role-sub { font-size: 12px; color: var(--muted); font-style: italic; margin-bottom: 3px; }

textarea, input[type="text"], input[type="email"], input[type="password"], input[type="url"], select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff;
}
textarea { resize: vertical; line-height: 1.55; }
textarea:focus, input:focus, select:focus { outline: 2px solid #b9c9f5; border-color: var(--blue); }
.field { display: block; font-size: 13px; font-weight: 600; color: #3c4657; margin: 12px 0 4px; }

/* ---------- action rail ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.downloads { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.dl {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font-size: 13px;
  font-weight: 600; color: var(--navy); background: #fff; text-decoration: none !important;
}
.dl:hover { border-color: var(--navy); }

.submit-box { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-top: 14px; background: #fbfcfe; }
.submit-box.armed { border-color: var(--green); background: #f4fbf7; }
.submit-box h4 { margin: 0 0 6px; font-size: 14.5px; }
.checklist { list-style: none; padding: 0; margin: 10px 0; font-size: 13.5px; }
.checklist li { padding: 3px 0; }
.checklist li::before { content: "☐ "; color: var(--muted); }

/* ---------- tables ---------- */
table.grid { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.grid th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fafbfd; }
table.grid td { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; align-items: start; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, #eef1f7, #dfe5f0); }
.login-card {
  background: #fff; border-radius: 14px; box-shadow: 0 10px 40px rgba(31,42,68,.14);
  padding: 38px 34px; width: 340px; display: flex; flex-direction: column; gap: 13px; text-align: center;
}
.login-card input { text-align: center; }
.error { color: var(--red); background: var(--red-bg); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; margin: 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px);
  background: var(--navy); color: #fff; border-radius: 10px; padding: 11px 20px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: all .25s; box-shadow: 0 8px 30px rgba(31,42,68,.35); z-index: 50; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
code.k { background: var(--grey-bg); border-radius: 5px; padding: 1px 6px; font-size: 12.5px; }
