:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e3e6eb;
  --text: #15181e;
  --muted: #5f6775;
  --accent: #2f5bea;
  --accent-ink: #ffffff;
  --accent-soft: #e8eefe;
  --good: #116b32; /* ≥4.5:1 on --good-soft */
  --good-soft: #e6f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --bad: #c62828;
  --bad-soft: #fdecec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1e222a;
    --border: #2a2f39;
    --text: #e8eaee;
    --muted: #9aa3b2;
    --accent: #6b8cff;
    --accent-ink: #0b0d12;
    --accent-soft: #1d2640;
    --good: #4ade80;
    --good-soft: #13281b;
    --warn: #fbbf24;
    --warn-soft: #2b2212;
    --bad: #f87171;
    --bad-soft: #2d1616;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font: inherit;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 550; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

.pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.pill.Saved { background: var(--surface-2); color: var(--muted); }
.pill.Applied { background: var(--accent-soft); color: var(--accent); }
.pill.Interview { background: var(--warn-soft); color: var(--warn); }
.pill.Offer { background: var(--good-soft); color: var(--good); }
.pill.Rejected, .pill.Withdrawn { background: var(--bad-soft); color: var(--bad); }
.pill.Ghosted { background: var(--surface-2); color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; font-weight: 550;
  opacity: 0; transition: .2s; pointer-events: none; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* `hidden` must win over component display rules (.btn, .pick, …). */
[hidden] { display: none !important; }

.ext-status { margin-top: auto; padding: 10px 8px 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.ext-status + .side-foot { margin-top: 8px !important; }
.ext-status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); margin-right: 6px; }
.ext-status .dot.on { background: var(--good); }
.pro-badge { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: linear-gradient(135deg, #6d4aff, #2f5bea); color: #fff !important; text-decoration: none !important; }
.pro-badge.on { letter-spacing: .06em; }
.lock::after { content: "PRO"; margin-left: 6px; font-size: 9.5px; font-weight: 800; letter-spacing: .05em; padding: 2px 5px; border-radius: 4px; background: linear-gradient(135deg, #6d4aff, #2f5bea); color: #fff; }
.spin { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; margin-right: 6px; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- app shell ---------- */
.navlist { display: flex; flex-direction: column; gap: 2px; }
.navlink { display: flex !important; align-items: center; gap: 10px; }
.navlink svg { flex: none; opacity: .75; }
.navlink.active svg { opacity: 1; }
.navlink .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.card { transition: box-shadow .15s, border-color .15s, transform .15s; }
.card.clickable:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); box-shadow: 0 4px 14px rgba(16, 24, 40, .08); }
.card.selected { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------- company avatar ---------- */
.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 10px; font-weight: 700; letter-spacing: .02em;
  color: hsl(var(--h) 55% 32%); background: hsl(var(--h) 70% 92%); }
@media (prefers-color-scheme: dark) { .avatar { color: hsl(var(--h) 70% 82%); background: hsl(var(--h) 35% 22%); } }

/* ---------- job details drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(10, 12, 16, .35); z-index: 60; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -12px 0 32px rgba(0, 0, 0, .12); z-index: 61; display: flex; animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(32px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.drawer-inner { overflow: auto; padding: 22px 24px 40px; width: 100%; outline: none; }
.d-head { display: flex; gap: 14px; align-items: flex-start; }
.d-title { flex: 1; min-width: 0; }
.d-title h2 { font-size: 19px; line-height: 1.3; margin-bottom: 4px; }
.d-close { padding: 0 8px; }
.d-facts { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 14px 0; color: var(--muted); font-size: 13.5px; align-items: center; }
.d-facts .fact { display: inline-flex; gap: 6px; align-items: center; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.d-actions .btn { gap: 6px; }
.d-match { display: flex; gap: 16px; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid var(--border); }
.d-match ul { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; }
.d-match li.ok { color: var(--text); }
.d-match li.warn { color: var(--warn); }
.d-desc h3 { font-size: 14px; margin: 16px 0 8px; }
.jdtext { white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; }
.ring { --p: 0; --c: var(--accent); width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring span { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.ring.hi { --c: var(--good); } .ring.mid { --c: var(--accent); } .ring.lo { --c: var(--warn); }
.kbd-hint { font-size: 12px; color: var(--muted); }
.kbd-hint kbd { padding: 0 5px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); font: 11.5px ui-monospace, Menlo, monospace; }
@media (max-width: 640px) { .drawer { width: 100vw; } .drawer-inner { padding: 16px; } }
@media (max-width: 860px) {
  .navlist { flex-direction: row; flex-wrap: wrap; gap: 2px; width: 100%; }
  .navlink { padding: 6px 9px; font-size: 13.5px; }
  .navlink .count { margin-left: 2px; }
  .ext-status { margin-top: 0; padding: 4px 8px; }
  .kbd-hint { display: none; }
}

/* ---------- Copilot ---------- */
.copilot-fab { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 16px;
  border: 0; border-radius: 999px; background: linear-gradient(135deg, #2f5bea, #7c3aed); color: #fff; /* fixed colors: white text stays readable (≥4.5:1) in dark mode */
  font: 600 13.5px/1 inherit; box-shadow: 0 8px 24px rgba(47, 91, 234, .35); cursor: pointer; transition: transform .15s, box-shadow .15s; }
.copilot-fab:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(47, 91, 234, .45); }
.copilot { position: fixed; right: 20px; bottom: 74px; z-index: 70; width: min(420px, calc(100vw - 32px)); height: min(620px, calc(100vh - 110px));
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 18px 50px rgba(16, 24, 40, .22); overflow: hidden; }
.copilot[hidden] { display: none; }
.copilot header { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); }
.copilot header .cp-ctx { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.cp-hello { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; }
.cp-hello p { margin: 6px 0 0; }
.cp-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.cp-msg p { margin: 0 0 6px; } .cp-msg p:last-child { margin: 0; }
.cp-msg ul { margin: 2px 0 6px; padding-left: 18px; }
.cp-msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.cp-msg.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.cp-msg.typing { display: flex; gap: 4px; padding: 12px 14px; }
.cp-msg.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: cpdot 1s infinite ease-in-out; }
.cp-msg.typing span:nth-child(2) { animation-delay: .15s; } .cp-msg.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes cpdot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.cp-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.cp-suggest[hidden] { display: none; }
.cp-chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 10px; font: 12.5px/1.2 inherit; cursor: pointer; text-align: left; }
.cp-chip:hover { border-color: var(--accent); color: var(--accent); }
.cp-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--border); }
.cp-form textarea { flex: 1; resize: none; min-height: 36px; max-height: 140px; border-radius: 10px; padding: 8px 10px; font: inherit; }
@media (max-width: 640px) {
  .copilot-fab span { display: none; }
  .copilot-fab { width: 46px; height: 46px; padding: 0; justify-content: center; font-size: 18px; bottom: 16px; right: 16px; }
  .copilot { right: 8px; left: 8px; width: auto; bottom: 70px; height: calc(100vh - 90px); }
}
@media (prefers-reduced-motion: reduce) { .cp-msg.typing span { animation: none; } .copilot-fab { transition: none; } }

/* ---------- shared: people links, job details sections ---------- */
.people { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 12px; }
.chiplink { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 12.5px; font-weight: 550; }
.chiplink:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.d-facts2, .d-skills, .d-people, .d-h1b { padding: 14px 0; border-bottom: 1px solid var(--border); }
.d-skills h3, .d-people h3, .d-h1b h3 { font-size: 14px; margin-bottom: 8px; }
.d-h1b p { margin: 4px 0; font-size: 13.5px; }
.d-facts2 dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; margin: 0; }
.d-facts2 dt { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.d-facts2 dd { margin: 2px 0 0; font-size: 13.5px; font-weight: 550; }
.skillset { display: flex; flex-wrap: wrap; gap: 6px; }
.sk { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 6px; font-size: 12.5px; font-weight: 550; }
.sk.have { background: var(--good-soft); color: var(--good); }
.sk.miss { background: var(--surface-2); color: var(--muted); }
.d-people p { margin: 0; }
.d-pay { padding: 14px 0; border-bottom: 1px solid var(--border); } .d-pay h3 { font-size: 14px; margin-bottom: 4px; } .d-pay p { margin: 0; } .d-pay strong { font-size: 16px; margin-right: 6px; }

/* restore banner */
.restore-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 16px; margin-bottom: 16px; border-left: 3px solid var(--warn); background: var(--warn-soft); }
.restore-banner .actions { margin: 0; }
.side .fb-link { border: 0; background: none; width: 100%; text-align: left; font: inherit; cursor: pointer; color: var(--muted); margin-top: 6px; }
.side .fb-link:hover { color: var(--text); }
#fbDialog { width: min(520px, calc(100vw - 32px)); }

/* accessibility helpers */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none !important; }
  .spin, .spinner { animation-duration: 3s !important; }
}

/* Adzuna's terms: a linked "Adzuna" label at least 116 × 23 px wherever their listings appear */
.adzuna-credit { display: inline-flex; align-items: center; justify-content: center; min-width: 124px; min-height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-weight: 650; font-size: 13px; text-decoration: none; white-space: nowrap; }
.adzuna-credit:hover { border-color: var(--accent); }
