:root {
  --bg: #0f1720;
  --panel: #172230;
  --panel-2: #1e2c3c;
  --ink: #e8eef5;
  --muted: #9fb0c3;
  --line: #2a3a4d;
  --accent: #f5a623;
  --remote: #14c38e;
  --hybrid: #4f9dff;
  --ok: #14c38e;
  --danger: #ff6b6b;
  --purple: #cdb4ff;
  --purple-border: rgba(190, 150, 255, 0.55);
  --purple-hover: rgba(190, 150, 255, 0.14);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--hybrid); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .8rem 1.4rem; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: inline-flex; align-items: center; }
.brand:hover { text-decoration: none; }
.logo { height: 38px; width: auto; display: block; }
.topbar nav { display: flex; align-items: center; gap: 1.1rem; margin-left: auto; }
.inline { display: inline; margin: 0; }

main { max-width: 900px; margin: 0 auto; padding: 1.5rem 1.4rem 3rem; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; color: var(--muted); }

/* Pronounced tier headings */
.tier { font-size: 1.5rem; font-weight: 800; color: var(--ink); letter-spacing: .2px;
  margin: 2rem 0 .9rem; padding-bottom: .35rem; border-bottom: 2px solid var(--line);
  text-transform: none; }
.tier-1 { border-bottom-color: var(--accent); }
.tier-2 { border-bottom-color: var(--hybrid); }

.report-header .meta { color: var(--muted); font-size: .9rem; margin-bottom: .5rem; }
.pill { display: inline-block; padding: .1rem .5rem; border: 1px solid var(--line);
  border-radius: 999px; font-size: .8rem; margin-left: .4rem; }
.pill.running { color: var(--accent); border-color: var(--accent); }
.pill.error { color: var(--danger); border-color: var(--danger); }

.status-panel { background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: .6rem .9rem; margin-bottom: 1.2rem; }
.status-panel summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.status-panel .status-counts { color: var(--ink); font-size: .9rem; margin: .5rem 0; }
.status-panel .status-counts .status-link { color: var(--accent); text-decoration: underline;
  text-underline-offset: 2px; }
.status-panel .status-counts .status-link:hover { color: var(--accent-2, var(--accent)); }
.status-panel .log { background: var(--bg); border: 1px solid var(--line);
  border-radius: 7px; padding: .6rem .7rem; margin: .5rem 0 .3rem; max-height: 240px;
  overflow: auto; font-size: .78rem; line-height: 1.35; color: var(--muted);
  white-space: pre-wrap; }
.status-panel code { background: var(--bg); padding: .05rem .3rem; border-radius: 4px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: .9rem 1rem; margin-bottom: .8rem; }
.card-head { display: flex; gap: .9rem; align-items: baseline; }
.score { font-size: 1.5rem; font-weight: 700; color: var(--accent); min-width: 2.6rem; }
.job-title { font-weight: 600; font-size: 1.05rem; }
.company { color: var(--muted); font-size: .9rem; }

.badges { display: flex; flex-wrap: wrap; gap: .4rem; margin: .55rem 0; }
.badge { font-size: .74rem; padding: .12rem .55rem; border-radius: 999px;
  border: 1px solid rgba(150, 170, 195, .35); color: #b7c6d8;
  background: rgba(150, 170, 195, .12); font-weight: 600;
  display: inline-block; white-space: nowrap; line-height: 1.35; }
/* Tinted-pill palette: soft translucent chips, one hue per attribute.
   Remote stays a vivid solid fill so the boosted category pops. */
.badge.remote { color: #2a1400; border-color: #ff7a18; font-weight: 700;
  background: linear-gradient(100deg, #ff7a18 0%, #ff7a18 35%, #ffd9a8 50%, #ff7a18 65%, #ff7a18 100%);
  background-size: 220% 100%; animation: remote-shimmer 2.6s linear infinite; }
@keyframes remote-shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .badge.remote { animation: none; background: #ff7a18; }
}
.badge.hybrid { background: rgba(120, 160, 255, .16); color: #a9c4ff; border-color: rgba(120, 160, 255, .45); }
.badge.type   { background: rgba(190, 150, 255, .15); color: #cdb4ff; border-color: rgba(190, 150, 255, .45); }
.badge.comp   { background: rgba(255, 178, 70, .15); color: #ffcf87; border-color: rgba(255, 178, 70, .48); }
.badge.src    { background: rgba(95, 200, 210, .13); color: #93dbe2; border-color: rgba(95, 200, 210, .4); }
.badge.eu     { background: rgba(60, 200, 140, .16); color: #86efc0; border-color: rgba(60, 200, 140, .5); }
.badge.warn   { background: rgba(255, 120, 110, .15); color: #ffb0a8; border-color: rgba(255, 120, 110, .5); }

.summary { color: var(--ink); font-size: .92rem; margin: .4rem 0 .6rem; }

/* Card actions: aligned row; Applied/Save/Skip are outline (text + border),
   Open posting is the filled primary. */
.card-actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: stretch; }
.card-actions .inline { display: inline-flex; }
.card-actions .btn { background: transparent; border: 1px solid var(--line);
  color: var(--ink); font-weight: 600; }
.card-actions .btn:hover { background: rgba(255, 255, 255, .08); }
.card-actions .btn.ok { background: transparent; color: var(--ok); border-color: var(--ok); }
.card-actions .btn.save { background: transparent; color: var(--accent); border-color: var(--accent); }
.card-actions .btn.save.is-saved { background: var(--accent); color: #201400; }
.card-actions .btn.danger { color: var(--danger); border-color: var(--danger); }
.card-actions .btn.small.link, .card-actions .btn.link { background: var(--ok); color: #05231a;
  border-color: var(--ok); font-weight: 700; }
.card-actions .btn.small.link:hover, .card-actions .btn.link:hover { background: var(--ok); filter: brightness(1.08); }
.card-actions .btn.not-interested {
  background: transparent;
  color: var(--purple);
  border: 1px solid var(--purple-border);
  font-weight: 600;
}
.card-actions .btn.not-interested:hover {
  background: var(--purple-hover);
  color: var(--purple);
  filter: none;
  text-decoration: none;
}
.card-actions .btn.not-interested:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.btn { display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #201400; border: none; border-radius: 7px;
  padding: .5rem .9rem; font-weight: 600; cursor: pointer; text-decoration: none;
  line-height: 1.2; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.small { padding: .28rem .6rem; font-size: .82rem; }
.btn.tiny { padding: .15rem .45rem; font-size: .74rem; }
.btn.link, .btn.small.link { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); }
.btn.ok { background: var(--ok); color: #05231a; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn:disabled, .btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover, .btn[disabled]:hover { filter: none; }

/* Stale-data refresh prompt (Report) */
.refresh-prompt { display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; background: var(--panel); border: 1px solid var(--accent);
  border-left: 4px solid var(--accent); border-radius: 8px;
  padding: .7rem 1rem; margin-bottom: 1rem; }
.refresh-prompt > div { line-height: 1.4; }

/* Version panel (Preferences) */
.version-panel { display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: .8rem 1.1rem; margin-bottom: 1.2rem; }
.version-panel.stale { border-color: var(--accent); }
.version-panel .version-info div:first-child { font-weight: 600; }

.empty, .muted { color: var(--muted); }
.flashes { margin-bottom: 1rem; }
.flash { padding: .5rem .8rem; border-radius: 7px; margin-bottom: .4rem; }
.flash.ok { background: #10352a; color: var(--remote); }
.flash.error { background: #3a1a1a; color: var(--danger); }
.flash.warn { background: #3a331a; color: #e8c66a; }

/* Assigned-password nudge banner */
.pw-nag { background: #3a331a; color: #e8c66a; border: 1px solid #6b5a1f;
  padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; font-size: .95rem; }
.pw-nag a { color: #f6da8c; font-weight: 600; }

/* Preferences */
.prefs fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 1rem;
  padding: 1rem 1.1rem; background: var(--panel); }
.prefs legend { color: var(--accent); font-weight: 700; padding: 0 .4rem; }
.prefs label { display: block; margin: .6rem 0; color: var(--muted); }
.prefs label.chk { color: var(--ink); }
.prefs input[type=text], .prefs input[type=number], .prefs textarea, .prefs input[type=file] {
  display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 7px;
  font: inherit; }
.prefs textarea { resize: vertical; }
.hint { color: var(--muted); font-size: .86rem; margin: .2rem 0 .6rem; }

/* Pipeline tables */
.grid { width: 100%; border-collapse: collapse; margin-bottom: 1.4rem; font-size: .9rem; }
.grid th, .grid td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); }
.grid th { color: var(--muted); font-weight: 600; }

/* Login */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 2rem; }
.login-shell { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem;
  max-width: 900px; align-items: center; }
@media (max-width: 760px) { .login-shell { grid-template-columns: 1fr; gap: 1.5rem; } }
.login-intro .login-brand { color: var(--accent); font-size: 2rem; margin: 0 0 .3rem; }
.login-intro .tagline { color: var(--ink); font-size: 1.05rem; margin: 0 0 .2rem; }
.app-version { color: var(--muted); font-size: .72rem; letter-spacing: .02em; }
.login-intro .app-version { margin: 0 0 1rem; }
.foot .app-version { display: block; margin-top: .2rem; font-size: .68rem; }
.login-blurb { color: var(--muted); line-height: 1.55; margin: 0 0 1.1rem; }
.invite-badge { display: inline-block; font-size: .8rem; letter-spacing: .5px;
  color: #ffcf87; background: rgba(255,178,70,.15); border: 1px solid rgba(255,178,70,.48);
  padding: .25rem .6rem; border-radius: 999px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 1.8rem; width: 100%; max-width: 360px; }
.login-card h1, .login-card h2 { color: var(--accent); font-size: 1.15rem; margin: 0 0 .4rem; }
/* Decorative emblem, centered on the heading line inside the card's own padding. */
.login-card-with-icon { position: relative; }
.login-card-with-icon h2 { padding-right: 2.4rem; }
.login-card-icon {
  position: absolute; top: 1.8rem; right: 1.8rem; width: 1.6rem; height: 1.6rem;
  opacity: .5; pointer-events: none; user-select: none;
}
@media (max-width: 420px) {
  .login-card-icon { width: 1.35rem; height: 1.35rem; top: calc(1.8rem + 2px); right: 1.5rem; }
  .login-card-with-icon h2 { padding-right: 2rem; }
}
.login-card label { display: block; color: var(--muted); margin: .9rem 0 0; }
.login-card .password-input-wrap { display: flex; gap: .45rem; align-items: stretch; margin-top: .3rem; }
.login-card .password-input-wrap input { flex: 1; margin-top: 0; min-width: 0; }
.login-card .password-input-wrap .password-reveal { flex-shrink: 0; margin-top: 0; width: auto; padding: .45rem .7rem; }
.login-card input, .login-card textarea { width: 100%; padding: .55rem; margin-top: .3rem;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 7px; }
.login-card .btn { width: 100%; margin-top: 1.1rem; }
.login-card small.hint { display: block; color: var(--muted); margin-top: .25rem; font-size: .8rem; }
.login-alt { color: var(--muted); margin-top: 1rem; font-size: .9rem; }
.login-alt a { color: var(--accent); }

/* Pages that show the shared footer under a centered login-style layout. */
.login-body:has(> .foot) {
  display: flex; flex-direction: column; align-items: center;
  min-height: 100vh; min-height: 100dvh; padding: 2rem 1.2rem 0;
}
.login-body:has(> .foot) > .login-shell { margin: auto; width: 100%; }
.login-body:has(> .foot) > .foot { width: 100%; }

/* What's new: centered title over a fixed-height card whose history scrolls. */
.login-body.changelog-body {
  display: flex; flex-direction: column; align-items: center;
  min-height: 100vh; min-height: 100dvh;
  padding: clamp(1.5rem, 7vh, 4.5rem) 1.2rem 0;
}
.changelog-page {
  display: flex; flex-direction: column; width: min(34rem, 100%);
  margin: auto; padding: 0; max-width: none;
}
.changelog-page .login-intro { text-align: center; margin-bottom: 1.3rem; }
.changelog-page .login-blurb { margin: 0; font-size: .95rem; }
.changelog-card {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 14px 34px rgba(0, 0, 0, .28); overflow: hidden;
}
.changelog-scroll {
  max-height: clamp(13rem, calc(100dvh - 19rem), 23rem);
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable; text-align: left; padding: 1.15rem .9rem 1.4rem 1.3rem;
}
.changelog-scroll:focus { outline: none; }
.changelog-card:has(.changelog-scroll:focus-visible) { border-color: var(--accent); }
.changelog-scroll::-webkit-scrollbar { width: 12px; }
.changelog-scroll::-webkit-scrollbar-track {
  margin: 12px 0; border-radius: 999px; background: rgba(255, 255, 255, .035);
  border: 4px solid var(--panel); background-clip: padding-box;
}
.changelog-scroll::-webkit-scrollbar-thumb {
  min-height: 2.5rem; border-radius: 999px; background: rgba(245, 166, 35, .42);
  border: 3px solid var(--panel); background-clip: padding-box;
}
.changelog-scroll::-webkit-scrollbar-thumb:hover { background-color: rgba(245, 166, 35, .7); }
@supports not selector(::-webkit-scrollbar) {
  .changelog-scroll { scrollbar-width: thin; scrollbar-color: rgba(245, 166, 35, .5) rgba(255, 255, 255, .04); }
}
.changelog-card::before, .changelog-card::after {
  content: ""; position: absolute; left: 0; right: 14px; pointer-events: none;
  opacity: 0; transition: opacity .2s ease; z-index: 1;
}
.changelog-card::before { top: 0; height: 1.6rem;
  background: linear-gradient(var(--panel), rgba(23, 34, 48, 0)); }
.changelog-card::after { bottom: 0; height: 3.2rem;
  background: linear-gradient(rgba(23, 34, 48, 0), var(--panel) 85%); }
.changelog-card.more-above::before, .changelog-card.more-below::after { opacity: 1; }
.changelog-more {
  margin: .55rem 0 0; text-align: center; color: var(--muted); font-size: .78rem;
  letter-spacing: .02em; visibility: hidden; opacity: 0; transition: opacity .2s ease;
}
.changelog-card.more-below + .changelog-more { visibility: visible; opacity: 1; }
.changelog-entry h2 { margin: 0 0 .5rem; color: var(--ink); font-size: 1.02rem; line-height: 1.35; }
.changelog-entry + .changelog-entry { margin-top: 1.4rem; padding-top: 1.2rem;
  border-top: 1px solid var(--line); }
.changelog-entry ul { margin: 0; padding-left: 1.15rem; }
.changelog-entry li { margin: 0 0 .45rem; line-height: 1.5; }
.changelog-entry li:last-child { margin-bottom: 0; }
.changelog-page .login-alt { text-align: center; margin-top: .6rem; }
.changelog-body > .foot { width: 100%; margin-top: auto; padding-top: 1.2rem; padding-bottom: .8rem; }

/* Phones: one scroll region only. The page stays still and the card fills the space. */
@media (max-width: 600px) and (min-height: 521px) {
  .login-body.changelog-body { height: 100vh; height: 100dvh; overflow: hidden; padding-top: 1.3rem; }
  .changelog-page { flex: 1 1 auto; min-height: 0; }
  .changelog-page .login-intro { margin-bottom: .9rem; }
  .changelog-page .login-intro .login-brand { font-size: 1.75rem; }
  .changelog-card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .changelog-scroll { flex: 1 1 auto; min-height: 0; max-height: none;
    padding: 1rem .7rem 1.3rem 1.05rem; }
  .changelog-more { margin-top: .4rem; }
  .changelog-page .login-alt { margin-top: .35rem; }
  .changelog-body > .foot { padding-top: .6rem; padding-bottom: .6rem; }
}
/* Short screens (phone landscape): drop the inner scroller and let the page scroll. */
@media (max-height: 520px) {
  .changelog-scroll { max-height: none; overflow: visible; }
  .changelog-card::before, .changelog-card::after, .changelog-more { display: none; }
}

/* Nav: signed-in user menu */
.topbar nav .who { color: var(--muted); font-size: .85rem; padding-left: .4rem; }
.user-menu { position: relative; }
.user-menu summary.who {
  cursor: pointer; list-style: none; border-radius: 6px; padding: .15rem .4rem;
}
.user-menu summary.who::-webkit-details-marker { display: none; }
.user-menu summary.who:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }
.user-menu[open] summary.who { color: var(--ink); }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 50;
  min-width: 9rem; padding: .45rem .55rem; display: flex; flex-direction: column; gap: .45rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.user-menu-panel a { color: var(--accent); font-size: .85rem; text-decoration: none; }
.user-menu-panel a:hover { text-decoration: underline; }
.user-menu-panel form { margin: 0; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: rgba(255, 255, 255, .08); filter: none; }
/* Disabled look for non-<button> elements (e.g. a grayed-out Skip <span>). */
.btn.is-disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* Admin tables */
.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th, .admin-table td { text-align: left; padding: .4rem .5rem;
  border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { color: var(--muted); font-weight: 600; }
.admin-table td.note { max-width: 260px; color: var(--muted); }
.admin-table .row-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.admin-table .row-actions input[type=password] { width: 130px; padding: .3rem .4rem;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; }

/* Help page */
.help-intro { color: var(--muted); font-size: .95rem; margin-bottom: 1rem; }
section.onboarding { margin-bottom: 1.4rem; }
.onboarding-actions {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 1rem 1.1rem; margin-top: 1.5rem;
}
.onboarding-actions .form-actions { margin-top: .85rem; }
label.feed-unavailable { opacity: .75; }
label.feed-unavailable input:disabled { cursor: not-allowed; }
.help { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: .8rem 1.1rem; margin-bottom: 1rem; }
.help h2 { color: var(--accent); font-size: 1.05rem; margin: .3rem 0 .6rem; }
.help ul, .help ol { margin: .3rem 0; padding-left: 1.3rem; }
.help li { margin: .3rem 0; }
.help code { background: var(--bg); padding: .05rem .35rem; border-radius: 4px; font-size: .86rem; }

/* Floating actions: back-to-top (accent) and undo (gold, above it) */
.back-to-top, .undo-action {
  position: fixed; right: 1.25rem; z-index: 1000;
  width: 2.75rem; height: 2.75rem; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  line-height: 1; cursor: pointer; text-decoration: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .4);
  transition: opacity .2s ease, transform .15s ease, filter .15s ease;
}
.back-to-top { bottom: 1.25rem; background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); font-size: 1.35rem; }
.undo-action { bottom: 4.5rem; background: var(--accent); color: #201400; font-size: 1.5rem; }
.back-to-top:hover, .undo-action:hover { transform: translateY(-2px); filter: brightness(1.1); text-decoration: none; }
.back-to-top.is-hidden, .undo-action.is-hidden { opacity: 0; pointer-events: none; }

/* Card collapse animation for in-page Applied/Save/Skip */
.card.collapsing { overflow: hidden; transition: max-height .25s ease, opacity .2s ease,
  margin .25s ease, padding .25s ease; }

/* Refresh: running toast (top-center) + completion prompt */
.refresh-toast, .refresh-done {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 1100;
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .9rem; border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .45); font-size: .9rem;
  transition: opacity .2s ease, transform .2s ease;
}
.refresh-toast { top: 1rem; background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); }
.refresh-done { top: 1rem; background: var(--panel); color: var(--ink);
  border: 1px solid var(--ok); border-left: 4px solid var(--ok); }
.refresh-done { top: 4.4rem; padding: .85rem 1.1rem; font-size: .95rem; max-width: min(46rem, calc(100% - 2rem));
  width: max-content; border-width: 2px; border-left-width: 6px;
  background: linear-gradient(0deg, rgba(60, 200, 140, .12), rgba(60, 200, 140, .12)), var(--panel);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .55), 0 0 0 1px rgba(60, 200, 140, .35); }
.refresh-done-icon { flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ok); color: #05231a; font-weight: 800; font-size: 1.05rem; }
.refresh-done-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.refresh-done-body strong { font-size: 1.02rem; }
.refresh-done-actions { flex-wrap: wrap; }
.refresh-done.is-attention { animation: refresh-done-pulse 1.1s ease-out 3; }
@keyframes refresh-done-pulse {
  0%   { box-shadow: 0 8px 30px rgba(0, 0, 0, .55), 0 0 0 0 rgba(60, 200, 140, .75); }
  100% { box-shadow: 0 8px 30px rgba(0, 0, 0, .55), 0 0 0 18px rgba(60, 200, 140, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .refresh-done.is-attention { animation: none; outline: 3px solid var(--ok); outline-offset: 3px; }
}
@media (max-width: 640px) { .refresh-done { width: auto; left: 1rem; right: 1rem; transform: none;
    flex-wrap: wrap; }
  .refresh-done-body { flex: 1 1 calc(100% - 3rem); }
  .refresh-done-actions { margin-left: 0; }
  .refresh-done.is-hidden { transform: translateY(-8px); } }
.refresh-done.is-error { border-color: #ff6b6b; border-left-color: #ff6b6b;
  background: linear-gradient(0deg, rgba(255, 107, 107, .12), rgba(255, 107, 107, .12)), var(--panel); }
.refresh-done.is-error .refresh-done-icon { background: #ff6b6b; color: #2a0606; }
.refresh-done.is-quiet { border-color: var(--line); border-left-color: var(--muted); background: var(--panel); }
.refresh-done.is-quiet .refresh-done-icon { background: var(--panel-2); color: var(--ink); }
.feed-health { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center;
  margin: 0 0 1rem; font-size: .88rem; }
.feed-health .pill { font-size: .78rem; }
.feed-health .muted-pill { opacity: .85; }
.refresh-done-actions { display: inline-flex; gap: .4rem; margin-left: .3rem; }
.refresh-toast.is-hidden, .refresh-done.is-hidden {
  opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(-8px); }
.spinner {
  width: 1rem; height: 1rem; border-radius: 50%;
  border: 2px solid rgba(245, 166, 35, .3); border-top-color: var(--accent);
  animation: spin .8s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem; }

/* Narrow viewports (phone): wrap header nav, contain horizontal overflow */
@media (max-width: 768px) {
  html { overflow-x: clip; }
  body { overflow-x: clip; max-width: 100%; }

  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: .55rem .75rem;
    padding: .65rem 1rem;
    max-width: 100%;
  }
  .brand { flex: 0 1 auto; max-width: 100%; min-width: 0; }
  .logo {
    height: 34px;
    max-width: min(200px, 52vw);
    width: auto;
  }
  /* Decorative rule under JOB in the SVG wordmark can read as a stray line when scaled/cropped */
  .logo .logo-rule { display: none; }

  .topbar nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem .65rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
    font-size: .88rem;
  }
  .topbar nav a { flex: 0 0 auto; }
  .topbar nav .inline { flex: 0 0 auto; }
  .topbar nav .btn.small { font-size: .78rem; padding: .24rem .5rem; }
  .user-menu { flex: 0 0 auto; max-width: 100%; }
  .user-menu summary.who {
    max-width: 8.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: none;
    outline: none;
  }
  .user-menu:not([open]) .user-menu-panel { display: none; }
  main { padding-left: 1rem; padding-right: 1rem; }
  .refresh-prompt { flex-direction: column; align-items: stretch; }
  .version-panel { flex-direction: column; align-items: stretch; }
}

.unsaved-dialog { background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 1.2rem 1.4rem; max-width: 30rem; width: calc(100% - 2rem); }
.unsaved-dialog::backdrop { background: rgba(5, 10, 16, .65); }
.unsaved-dialog h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.unsaved-dialog ul { margin: .4rem 0 1rem; padding-left: 1.2rem; color: var(--muted);
  max-height: 14rem; overflow-y: auto; }
.unsaved-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

fieldset.lifecycle { border-color: rgba(255, 107, 107, .35); }
fieldset.lifecycle legend { color: #ffb0a8; }
fieldset.lifecycle.undo { border-color: rgba(60, 200, 140, .45); }
fieldset.lifecycle.undo legend { color: #86efc0; }
.lifecycle-choice { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.lifecycle-form { margin-top: 2rem; }

/* First-time onboarding */
.onboard-overlay { position: fixed; inset: 0; z-index: 1200; display: flex;
  align-items: center; justify-content: center; background: rgba(5, 10, 16, .7); }
.onboard-overlay.is-hidden { display: none; }
.onboard-overlay-card { display: flex; align-items: center; gap: .8rem; padding: 1.1rem 1.4rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.onboard-wait { max-width: 34rem; margin: 4rem auto; text-align: center; }
.onboard-wait h1 { margin: 1rem 0 .5rem; }
.spinner.big { display: inline-block; width: 2.6rem; height: 2.6rem; border-width: 3px; }
.welcome-panel { background: var(--panel); border: 1px solid var(--line);
  border-left: 5px solid var(--ok); border-radius: 10px; padding: 1rem 1.2rem; margin: 0 0 1.2rem; }
.welcome-panel.warn { border-left-color: var(--accent); }
.welcome-panel h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.welcome-panel ul { margin: .3rem 0 .6rem; }
.prefs label.from-resume { border-left: 3px solid var(--ok); padding-left: .6rem;
  background: rgba(60, 200, 140, .07); border-radius: 4px; }
.welcome-savebar { position: sticky; bottom: 0; z-index: 50; display: flex; justify-content: flex-end;
  align-items: center; gap: .8rem; padding: .7rem 1rem; margin-top: 1rem;
  background: var(--panel); border-top: 1px solid var(--line); }

.password-help { margin-top: 1rem; padding: .75rem .9rem; border-radius: 8px;
  border: 1px solid rgba(245, 166, 35, .5); background: rgba(245, 166, 35, .1);
  font-size: .9rem; line-height: 1.45; }
.password-help strong { display: block; margin-bottom: .2rem; }
