:root {
  --ink: #12233b;
  --ink-2: #1d3557;
  --paper: #f6f8fb;
  --card: #ffffff;
  --line: #dbe3ee;
  --accent: #2b6cb0;
  --accent-2: #1f7a68;
  --amber: #b7791f;
  --red: #c53030;
  --muted: #5b6b85;
  --shadow: 0 1px 2px rgba(18, 35, 59, 0.06), 0 8px 24px rgba(18, 35, 59, 0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 "Segoe UI", system-ui, -apple-system, "Noto Sans Bengali", Roboto, sans-serif;
}
a { color: var(--accent); }
.loading { padding: 40px; color: var(--muted); }
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--ink);
  color: #dbe7f5;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
a.brand { color: #fff; text-decoration: none; }
a.brand:hover span { text-decoration: underline; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.3px; }
.brand-mark { border-radius: 8px; }
.nav-label { margin: 14px 0 8px; font-size: 10.5px; letter-spacing: 0.14em; color: #8ea6c4; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 8px;
  color: #c4d5ea; text-decoration: none; font-size: 13.6px; font-weight: 550;
}
.nav a svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; }
.nav a.active { background: #1d3557; color: #8fe3c8; }
.nav a:hover { background: #1d3557; }
.sidebar-bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid #24405f; font-size: 12px; color: #9fb4cf; }
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 26px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.crumb { color: var(--muted); font-size: 13px; }
.content { padding: 22px 26px 60px; max-width: 1180px; }
.headline { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.headline h1 { margin: 4px 0 6px; font-size: 27px; letter-spacing: -0.5px; }
.subtitle { margin: 0; color: var(--muted); max-width: 720px; }
.eyebrow { font-size: 11px; letter-spacing: 0.16em; color: var(--accent-2); font-weight: 700; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1.15fr 1fr; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 16px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.stats > .stat, .grid > .stat { min-width: 0; }
.grid.columns { grid-template-columns: 1.2fr 1fr; }
@media (max-width: 980px) {
  .grid.two, .grid.columns, .grid.three, .grid.four { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; width: 100%; }
  .layout { flex-direction: column; }
}
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 6px; font-size: 17px; }
.card h3 { font-size: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat-value { display: block; font-size: 26px; font-weight: 700; letter-spacing: -0.6px; }
.stat small { color: var(--muted); font-size: 11.5px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #e8eef7; color: var(--ink-2); }
.badge.green { background: #dff3ea; color: #1c6b57; }
.badge.amber { background: #fbf0da; color: #8a5a12; }
.badge.red { background: #fbe3e3; color: #97231f; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.muted { color: var(--muted); }
.caps { text-transform: uppercase; letter-spacing: 0.12em; font-size: 10.5px; }
button {
  font: inherit; padding: 7px 13px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer;
}
button:hover { border-color: #b9c8dd; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: #255d99; }
button.danger { border-color: #e2b4b4; color: var(--red); }
button.text-button { border: 0; background: none; color: var(--accent); padding: 2px 4px; }
button:disabled { opacity: 0.55; cursor: default; }
label.field { display: block; margin: 0 0 10px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
label.field small { display: block; font-weight: 400; font-size: 11.5px; margin-bottom: 3px; }
input, select, textarea {
  font: inherit; width: 100%; margin-top: 3px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { min-height: 84px; resize: vertical; }
.switch { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: 13px; }
.switch input { width: auto; margin-top: 4px; }
.switch small { display: block; color: var(--muted); font-size: 11.5px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 16px; }
.notice { background: #eef4ff; border: 1px solid #cddffb; color: #1d3557; padding: 10px 13px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.footnote { color: var(--muted); font-size: 11.6px; margin-top: 14px; }
.notes { font-size: 12.4px; color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.table-wrap { overflow-x: auto; }
/* The actions in a row are a set: Open · Find address · Pack · Check link. They
   wrap as a group if the window is narrow, never mid-label. */
.row-actions { white-space: nowrap; }
.row-actions > * { white-space: nowrap; }
.row-actions .button, .row-actions button { display: inline-block; margin: 0 4px 4px 0; }
table { width: 100%; border-collapse: collapse; font-size: 13.4px; }
th { text-align: left; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); }
td { padding: 10px 6px; border-bottom: 1px solid #eef2f8; vertical-align: top; }
.job-title { font-weight: 650; }
.job-meta { color: var(--muted); font-size: 11.8px; }
.score { font-weight: 700; }
.score.high { color: #1c6b57; }
.score.low { color: #8a5a12; }
.empty { padding: 18px; color: var(--muted); font-size: 13px; }
.event { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef2f8; font-size: 13px; }
.pill { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 9px; border-radius: 999px; background: #eef2f8; font-size: 11.5px; }
.pipe { display: flex; gap: 6px; flex-wrap: wrap; }
.pipe-step { padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--line); font-size: 11.5px; color: var(--muted); }
.pipe-step.done { border-style: solid; background: #dff3ea; color: #1c6b57; font-weight: 600; }
.pipe-step.now { border-style: solid; border-color: var(--accent); color: var(--accent); font-weight: 700; }
.visa-yes { color: var(--accent-2); font-weight: 600; }
.visa-no { color: var(--red); }
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; display: none;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 50;
  max-width: 90vw; box-shadow: var(--shadow);
}
dialog#drawer {
  border: 0; border-radius: 14px; padding: 22px; width: min(720px, 92vw);
  box-shadow: 0 20px 60px rgba(18, 35, 59, 0.28);
}
dialog#drawer::backdrop { background: rgba(18, 35, 59, 0.45); }
dialog#drawer .close { position: absolute; right: 12px; top: 8px; border: 0; background: none; font-size: 22px; cursor: pointer; }
.message { background: #f6f8fb; border-left: 3px solid var(--accent); padding: 8px 12px; font-size: 13px; white-space: pre-wrap; }
.login { max-width: 520px; margin: 12vh auto; text-align: center; }
.login-logo { max-width: 280px; }
.login-logo img { border-radius: 14px; display: block; margin-bottom: 4px; }
.reply { border-left: 3px solid var(--accent-2); padding-left: 12px; margin: 12px 0; }
@media (max-width: 720px) {
  .content { padding: 16px 14px 50px; }
  .topbar { padding: 12px 14px; }
}

/* ---------------------------------------------------------- v2 additions -- */
.grade-badge { font-weight: 800; letter-spacing: .02em; cursor: help; }
.reasons { color: var(--muted); font-size: 11.4px; margin-top: 2px; max-width: 420px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; font-size: 11.2px; color: var(--ink-2);
}
.chip.hit { background: #e8f7ef; border-color: #bce3cf; color: #1c6b57; }
.ready-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.ready-row > div:first-child { flex: 1 1 320px; }
.bulk-bar {
  position: sticky; bottom: 10px; margin-top: 12px; padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--ink); color: #fff; border-radius: 12px; flex-wrap: wrap;
}
.bulk-bar button { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .25); }
.bulk-bar button.danger { background: #7d2020; border-color: #7d2020; }
.check-col { width: 34px; text-align: center; }
.check-col input { width: auto; margin: 0; }
tr.picked { background: #f2f7ff; }
.nav-count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 10.6px; font-weight: 700; }
.build-line { font-size: 11.2px; color: #c6d6ea; margin: 8px 0 0; }
.build-line a { color: #a8cdf5; text-decoration: underline; }
.build-line .text-button { color: #a8cdf5; text-decoration: underline; }
.sort-field { display: inline-flex; align-items: center; gap: 6px; }
.sort-field select { padding: 5px 8px; }
.link-row { padding: 7px 0; border-bottom: 1px solid var(--line); }
.link-row a { color: var(--accent); }
.sidebar .text-button, .sidebar .text-button:hover { color: #a8cdf5; text-decoration: underline; }
.key-form { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.key-form input { flex: 1 1 140px; }
.row.wrap { flex-wrap: wrap; }
@media (max-width: 980px) {
  .reasons { max-width: none; }
  .bulk-bar { position: static; }
}

/* v3 — insight view */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 10px 0 6px; align-items: stretch; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
.stat-value { font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.2; overflow-wrap: anywhere; }
.stat-label { font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.table.slim th, .table.slim td { padding: 7px 9px; font-size: 13px; }
.chip.hit { background: #e6f5ef; border-color: #bfe3d5; color: #1c6b57; }
.headline h3, .card h3 { font-size: 15px; margin: 12px 0 6px; }

/* The page title is a real h1 for screen readers; it keeps the old look. */
.topbar h1.crumb { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: normal; }

/* Stat cards: one number, one label, one honest note — never run together. */
.grid.stats .stat {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.grid.stats .stat > strong { font-size: 26px; font-weight: 700; letter-spacing: -0.6px; line-height: 1.15; }
.grid.stats .stat > span { color: var(--ink); font-size: 13px; }
.grid.stats .stat > small { color: var(--muted); font-size: 11.5px; }
