:root {
  --bg: #0e1116;
  --panel: #151a22;
  --panel-2: #1c222c;
  --border: #262d39;
  --text: #e6e8eb;
  --muted: #8b95a5;
  --accent: #4f9eff;
  --accent-hover: #6ab0ff;
  --good: #36c285;
  --warn: #f0b341;
  --bad: #ef5350;
  --shadow: 0 1px 0 rgba(255,255,255,0.04), 0 8px 24px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button {
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  transition: background .12s ease, border-color .12s ease;
}
button:hover:not(:disabled) { background: #232a36; border-color: #2f3744; }
button:disabled { opacity: .45; cursor: not-allowed; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

button.danger { color: var(--bad); }
button.danger:hover:not(:disabled) { background: rgba(239, 83, 80, 0.1); }

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.actor-custom-input { margin-top: 6px; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-brand {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 18px;
}
.auth-brand span { color: var(--accent); }
.auth-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.2;
}
.auth-muted {
  color: var(--muted);
  margin: 0 0 18px;
}
.auth-card .field { margin-bottom: 12px; }
.auth-submit {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}
.auth-switch {
  width: 100%;
  margin-top: 10px;
  border-color: transparent;
  background: transparent;
  color: var(--accent);
}
.auth-switch:hover:not(:disabled) {
  background: rgba(79, 158, 255, 0.08);
  border-color: rgba(79, 158, 255, 0.2);
}
.auth-google-block {
  margin-top: 14px;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}
.google-signin-slot {
  min-height: 44px;
  display: grid;
  place-items: center;
}
.auth-google-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  color: var(--muted);
  font-size: 12px;
}
.auth-error {
  margin-top: 8px;
  color: var(--bad);
  font-size: 12px;
}
.user-hint {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.signout-btn {
  padding: 6px 10px;
  font-size: 12px;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}
.container.builder-container {
  --rb-page-height: calc(100vh - 32px);
  --rb-page-width: calc((100vh - 32px) * 0.7727);
  max-width: none;
  width: 100%;
  min-height: 100vh;
  padding: 16px;
}

header.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.app-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.app-title .accent { color: var(--accent); }

.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.active-hint { color: var(--muted); }
.active-hint strong { color: var(--text); }

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--panel-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  cursor: help;
}
.credit-pill .credit-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
}
.credit-pill.good { color: var(--good); border-color: rgba(54, 194, 133, 0.4); }
.credit-pill.good .credit-dot { background: var(--good); }
.credit-pill.warn { color: var(--warn); border-color: rgba(240, 179, 65, 0.5); }
.credit-pill.warn .credit-dot { background: var(--warn); }
.credit-pill.bad {
  color: var(--bad);
  border-color: rgba(239, 83, 80, 0.6);
  background: rgba(239, 83, 80, 0.08);
}
.credit-pill.bad .credit-dot { background: var(--bad); animation: pulse 1.4s ease-in-out infinite; }
.credit-pill.muted { color: var(--muted); }
.credit-warn {
  margin-left: 4px;
  padding: 1px 5px;
  background: rgba(239, 83, 80, 0.18);
  border-radius: 4px;
  font-size: 10px;
}
.settings-icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: var(--accent);
  background: var(--panel-2);
  border-color: var(--border);
  font-size: 17px;
  line-height: 1;
  flex-shrink: 0;
}
.settings-icon-btn[aria-expanded="true"] {
  border-color: rgba(79, 158, 255, 0.55);
  background: rgba(79, 158, 255, 0.12);
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.panel h3 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 0 0 auto; }
.row .grow { flex: 1 1 auto; min-width: 200px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 800px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* ── Top row: Resumes ─────────────────────────────────────────────────── */
.top-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
  align-items: start;
}
.top-row > .panel {
  width: 100%;
  min-width: 0;        /* prevent grid blowout from long inner content */
  margin-bottom: 0;    /* .top-row handles bottom spacing */
}
@media (max-width: 900px) {
  .top-row { grid-template-columns: 1fr; }
}

/* Resume strip — single line, scrolls horizontally */
.resume-panel, .settings-panel { padding: 0; overflow: hidden; }
.resume-strip {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.resume-strip::-webkit-scrollbar { height: 6px; }
.resume-strip::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}
.empty-inline {
  color: var(--muted);
  font-size: 12px;
  padding: 14px 6px;
  white-space: nowrap;
}

/* Resumes */
.resume-list { display: flex; flex-wrap: wrap; gap: 8px; }
.resume-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  flex-shrink: 0;
  max-width: 460px;
}
.resume-card.active {
  border-color: var(--accent);
  background: rgba(79, 158, 255, 0.08);
}
.resume-card-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.resume-card .name {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.resume-card .resume-meta {
  color: var(--muted);
  font-size: 11px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.resume-card .resume-meta strong {
  color: var(--text);
  font-weight: 600;
}
.skills-count-btn {
  width: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--accent);
  border-color: rgba(79, 158, 255, 0.35);
  background: rgba(79, 158, 255, 0.08);
}
.resume-skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 420px;
  max-height: 92px;
  overflow: auto;
  padding-top: 6px;
  scrollbar-width: thin;
}
.resume-card .active-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
}
.resume-card .skills-count {
  color: var(--muted);
  font-size: 11px;
}
.resume-card button {
  padding: 4px 8px;
  font-size: 12px;
}
.resume-card .skills-count-btn {
  padding: 2px 8px;
  font-size: 11px;
}

.upload-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.upload-btn input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Home settings panel */
.home-settings-panel-wrap {
  display: grid;
  justify-items: start;
  margin-bottom: 16px;
}
.home-settings-panel {
  width: 100%;
  margin-bottom: 0;
}
.settings-user-note {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

/* ── Collapsible single-line panels (Resumes) ─────────────────────────── */
.settings-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  border-radius: 10px;
  transition: background .12s ease;
  flex-wrap: nowrap;
  overflow: hidden;
}
.settings-summary:hover { background: rgba(255, 255, 255, 0.02); }
.resume-panel.collapsed .settings-summary,
.settings-panel.collapsed .settings-summary { border-radius: 10px; }
.resume-panel:not(.collapsed) .settings-summary,
.settings-panel:not(.collapsed) .settings-summary {
  border-radius: 10px 10px 0 0;
  border-bottom: 1px solid var(--border);
}

.chevron {
  display: inline-block;
  color: var(--muted);
  transition: transform .15s ease;
  font-size: 14px;
  flex-shrink: 0;
}
.chevron.open { transform: rotate(90deg); color: var(--accent); }

.settings-pills {
  display: flex;
  gap: 5px;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  overflow: hidden;
  align-items: center;
  min-width: 0;
}
.pill-mini {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
}
.pill-mini.on   { color: var(--good); border-color: rgba(54, 194, 133, 0.35); }
.pill-mini.off  { color: var(--muted); }
.pill-mini.neutral { color: var(--text); }

.scrape-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 13px;
}

/* Upload button — a <label> styled to match .scrape-btn */
.upload-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
  transition: background .12s ease, border-color .12s ease;
}
.upload-pill:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.upload-pill input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.settings-body { padding: 14px 18px 16px; }

/* Jobs */
.jobs-config-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.compact-field {
  flex: 0 0 150px;
  width: 150px;
}
.compact-field.mode-field {
  flex-basis: 165px;
  width: 165px;
}
/* Search Query gets the most space — it's the primary input on the card. */
.jobs-query-field {
  flex: 1 1 320px;
  min-width: 240px;
}

/* Visa-sponsorship badge in job rows */
.visa-badge {
  display: inline-block;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 999px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: 1px;
}
.visa-badge.yes { background: rgba(54, 194, 133, 0.16); color: var(--good); }
.visa-badge.no  { background: rgba(239, 83, 80, 0.16); color: var(--bad); }
.jobs-config-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.resume-search-summary {
  flex: 1 1 100%;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jobs-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.jobs-toolbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.jobs-sort-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.jobs-sort-control span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.jobs-sort-control select {
  width: 190px;
  min-height: 32px;
  padding: 5px 9px;
  font-size: 12px;
}
.scrape-inline-status {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

/* Secondary nav button — sits in the jobs toolbar top-right. Standard
   "section header + secondary action" pattern: a quiet outlined button
   with a counter pill, clearly clickable but not competing with primary
   actions on the page. */
.applied-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.applied-link-btn:hover {
  background: rgba(79, 158, 255, 0.10);
  border-color: rgba(79, 158, 255, 0.45);
  color: var(--accent);
}
.applied-link-icon { font-size: 13px; line-height: 1; }
.applied-link-count {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(79, 158, 255, 0.15);
  border-radius: 999px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.applied-link-arrow { color: var(--muted); font-size: 12px; }

/* Dedicated Applied History screen */
.applied-screen { margin-bottom: 16px; }
.applied-table th, .applied-table td { vertical-align: middle; }

/* Ad-hoc tailoring panel — paste any job URL and get curated PDFs */
.adhoc-panel { padding: 0; overflow: hidden; }
.adhoc-form { padding: 4px 0 12px; }
.adhoc-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}
@media (max-width: 700px) {
  .adhoc-form-grid { grid-template-columns: 1fr; }
}
.adhoc-paste-toggle {
  margin: 6px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--bg);
}
.adhoc-paste-toggle summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  user-select: none;
}
.adhoc-paste-toggle textarea {
  margin-top: 8px;
  min-height: 100px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}
.adhoc-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.adhoc-result {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.adhoc-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.adhoc-result-title {
  font-weight: 600;
  font-size: 15px;
}
.jobs-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.jobs-table th, .jobs-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: top;
}
.jobs-table th {
  background: var(--panel-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}
.jobs-table tr:last-child td { border-bottom: none; }
.jobs-table .col-title { width: 25%; }
.jobs-table .col-score {
  width: 86px;
  text-align: center;
  white-space: nowrap;
}
.jobs-table .col-new-score {
  width: 96px;
  text-align: center;
  white-space: nowrap;
}
.jobs-table .col-files {
  width: 152px;
  white-space: nowrap;
}
.jobs-table .col-status {
  width: 130px;
  text-align: center;
  white-space: nowrap;
}
.jobs-table .col-reason { width: 20%; }

.job-title { font-weight: 600; }
.job-title a { color: var(--text); text-decoration: none; }
.job-title a:hover { color: var(--accent); }
.job-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.application-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 10px;
  line-height: 1.4;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.application-status.idle {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--border);
}
.application-status.watching {
  color: var(--accent);
  background: rgba(79, 158, 255, 0.12);
  border-color: rgba(79, 158, 255, 0.28);
}
.application-status.setup {
  color: var(--warn);
  background: rgba(240, 179, 65, 0.13);
  border-color: rgba(240, 179, 65, 0.3);
}
.application-status.success {
  color: var(--good);
  background: rgba(54, 194, 133, 0.14);
  border-color: rgba(54, 194, 133, 0.28);
}
.application-status.failed {
  color: var(--bad);
  background: rgba(239, 83, 80, 0.12);
  border-color: rgba(239, 83, 80, 0.28);
}
.application-status.closed {
  color: var(--bad);
  background: rgba(239, 83, 80, 0.12);
  border-color: rgba(239, 83, 80, 0.28);
}
.status-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.status-action-segmented {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
  white-space: nowrap;
}
.status-action-btn {
  padding: 5px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 10px;
  line-height: 1.25;
  min-height: 26px;
}
.status-action-left { padding-left: 10px; }
.status-action-right { padding-right: 10px; }
.status-action-btn:hover:not(:disabled) {
  background: rgba(79, 158, 255, 0.08);
  color: var(--accent);
}
.status-action-separator {
  color: var(--muted);
  opacity: 0.55;
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
}
.skip-job-btn {
  color: var(--muted);
}
.skip-job-btn:hover:not(:disabled) {
  background: rgba(239, 83, 80, 0.08);
  color: var(--bad);
}

.job-skill-sections {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}
.job-skill-section {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}
.job-skill-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  padding-top: 3px;
}
.skill-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}
.skill-chip-list.compact {
  max-height: 50px;
  overflow: hidden;
}
.skill-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  line-height: 1.45;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}
.skill-chip.required { color: var(--accent); background: rgba(79, 158, 255, 0.12); border-color: rgba(79, 158, 255, 0.25); }
.skill-chip.available { color: var(--good); background: rgba(54, 194, 133, 0.13); border-color: rgba(54, 194, 133, 0.25); }
.skill-chip.missing { color: var(--bad); background: rgba(239, 83, 80, 0.12); border-color: rgba(239, 83, 80, 0.25); }
.skill-chip.more { color: var(--muted); }
.skill-empty {
  color: var(--muted);
  font-size: 12px;
}

.score {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  background: var(--panel-2);
}
.score.good { background: rgba(54, 194, 133, 0.18); color: var(--good); }
.score.warn { background: rgba(240, 179, 65, 0.18); color: var(--warn); }
.score.bad  { background: rgba(239, 83, 80, 0.18); color: var(--bad); }

.ats-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}
.ats-score {
  min-width: 66px;
  padding: 5px 12px;
  font-size: 13px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.tailored-score-cell {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tailored-loading {
  min-width: 66px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tailor-retry-btn {
  padding: 5px 9px;
  font-size: 12px;
  line-height: 1.2;
  border-radius: 999px;
}
.file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.file-segmented {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
  white-space: nowrap;
}
.file-btn {
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1.2;
  border: 0;
  border-radius: 0;
  background: transparent;
  min-height: 26px;
}
.file-btn:hover:not(:disabled) {
  background: rgba(79, 158, 255, 0.08);
  color: var(--accent);
}
.file-btn-left { padding-left: 10px; }
.file-btn-right { padding-right: 10px; }
.file-separator {
  color: var(--muted);
  opacity: 0.55;
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
}

.score-reason {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.matched-skills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.matched-skills .pill {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
}
.pill-req {
  background: rgba(54, 194, 133, 0.16);
  color: var(--good);
  font-weight: 600;
}
.pill-pref {
  background: rgba(79, 158, 255, 0.14);
  color: var(--accent);
}
.pill-miss {
  background: rgba(239, 83, 80, 0.14);
  color: var(--bad);
  font-weight: 600;
  cursor: help;
}
.pill-miss-full {
  background: rgba(239, 83, 80, 0.12);
  color: var(--bad);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  margin-right: 4px;
  margin-bottom: 4px;
  display: inline-block;
}

/* Expandable job row */
.job-row { cursor: pointer; }
.job-row:hover { background: rgba(255, 255, 255, 0.02); }
.job-row.expanded { background: rgba(79, 158, 255, 0.05); }
.breakdown-row td {
  background: var(--panel-2) !important;
  padding: 16px 18px !important;
}
.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 24px;
  margin-bottom: 12px;
}
@media (max-width: 800px) { .breakdown-grid { grid-template-columns: 1fr; } }
.factor {
  display: grid;
  grid-template-columns: 130px 1fr 48px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.factor-label { color: var(--muted); }
.factor-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}
.factor-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--good));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.factor-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
}
.breakdown-expl {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.breakdown-missing {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.breakdown-missing strong {
  color: var(--bad);
  margin-right: 8px;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.fix-resume-btn {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 0;
  border-radius: 999px;
}
.fix-resume-btn img {
  width: 13px;
  height: 13px;
  display: block;
}

/* Download resume button — same shape as the fix-resume pill */
.download-resume-btn {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 0;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
}

/* Resume builder */
.fix-screen { margin-bottom: 16px; }
.builder-screen {
  min-height: calc(100vh - 48px);
}
.builder-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.builder-title {
  flex: 1 1 auto;
  min-width: 0;
}
.builder-kicker,
.builder-doc-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.resume-title-input {
  margin-top: 2px;
  max-width: 460px;
  border-color: transparent;
  background: transparent;
  color: var(--text);
  padding: 2px 0;
  border-radius: 0;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 700;
}
.resume-title-input:focus {
  border-color: transparent;
  box-shadow: inset 0 -1px 0 var(--accent);
}
.builder-top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.builder-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: start;
}
.builder-nav,
.builder-document-panel,
.builder-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.builder-nav {
  padding: 12px;
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 86px);
  overflow: auto;
}
.builder-nav h3,
.builder-card h3 {
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.builder-section {
  margin-bottom: 8px;
}
.builder-section-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  text-align: left;
  color: var(--text);
}
.builder-section-btn span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.builder-section-btn small {
  color: var(--muted);
  font-size: 10px;
}
.builder-section-editor {
  margin: -2px 0 10px 0;
}
.builder-section-editor textarea {
  min-height: 138px;
  resize: vertical;
  font-size: 12px;
  line-height: 1.45;
  background: #10141b;
  border-color: #303846;
}
.builder-document-panel {
  min-width: 0;
  padding: 14px;
}
.builder-doc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}
.builder-doc-header strong {
  color: var(--text);
}
.builder-page {
  display: flex;
  justify-content: center;
  overflow: auto;
  background: #eef1f5;
  border: 1px solid #d8dde6;
  border-radius: 6px;
  padding: 22px;
  min-height: 72vh;
}
.resume-preview {
  width: min(100%, 760px);
  min-height: 900px;
  background: #fff;
  color: #111;
  border: 1px solid #cfd5df;
  border-radius: 3px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  padding: 38px 48px;
  font-family: "Times New Roman", Times, serif;
  font-size: 11px;
  line-height: 1.28;
}
.preview-name {
  text-align: center;
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
  margin-bottom: 6px;
}
.preview-contact {
  text-align: center;
  font-size: 9px;
  margin-bottom: 14px;
}
.preview-section {
  margin-top: 10px;
}
.preview-section h3 {
  margin: 8px 0 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid #111;
  color: #111;
  font-size: 12px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0;
}
.preview-section-body p {
  margin: 2px 0;
  white-space: pre-wrap;
}
.preview-bullet {
  display: flex;
  gap: 5px;
  padding-left: 14px;
}
.preview-bullet-dot {
  flex: 0 0 auto;
  margin-left: -10px;
}
.preview-empty-line {
  min-height: 5px;
}
.resume-preview-raw {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
}
.draft-status {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.builder-inspector {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 14px;
}
.builder-card {
  padding: 14px;
}
.builder-score-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.builder-score-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 12px;
}
.builder-score-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.builder-score-meta span {
  color: var(--muted);
}
@media (max-width: 1120px) {
  .builder-layout {
    grid-template-columns: 180px minmax(0, 1fr);
  }
  .builder-inspector {
    grid-column: 1 / -1;
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 820px) {
  .builder-topbar { align-items: flex-start; flex-wrap: wrap; }
  .builder-layout { grid-template-columns: 1fr; }
  .builder-nav,
  .builder-inspector { position: static; }
  .builder-inspector { grid-template-columns: 1fr; }
  .builder-page { padding: 12px; }
  .resume-preview { padding: 24px 20px; min-height: 72vh; }
  .preview-name { font-size: 24px; }
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.pagination button {
  min-width: 36px;
  padding: 6px 10px;
}
.pagination button.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.page-spin {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border: 2px solid rgba(139, 149, 165, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -1px;
}
.pagination .info {
  color: var(--muted);
  font-size: 12px;
  margin: 0 8px;
}

@media (max-width: 760px) {
  .compact-field {
    flex: 1 1 160px;
    width: auto;
  }
  .jobs-config-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 1000;
  font-size: 13px;
  max-width: 360px;
}
.toast.success { border-left: 3px solid var(--good); }
.toast.error   { border-left: 3px solid var(--bad); }
.toast.info    { border-left: 3px solid var(--accent); }

.warn-banner {
  background: rgba(240, 179, 65, 0.08);
  border: 1px solid rgba(240, 179, 65, 0.4);
  color: var(--warn);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 12px;
}

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 13px;
}

.spin {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--muted);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 6px;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.kbd {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

/* ──────────────────────────────────────────────────────────────────
   Structured Resume Builder (currentView === 'builder')
   ────────────────────────────────────────────────────────────────── */
.rb-screen {
  height: var(--rb-page-height);
  margin-bottom: 0;
}

.rb-title { flex: 1 1 auto; min-width: 0; }
.rb-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 3px;
}
.rb-name-input {
  font-size: 18px;
  font-weight: 600;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 8px;
  border-radius: 6px;
}
.rb-name-input:hover { border-color: var(--border); }
.rb-name-input:focus { border-color: var(--accent); background: var(--bg); }
.rb-name-static {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rb-top-actions { display: flex; gap: 8px; flex-shrink: 0; }

.rb-layout {
  display: grid;
  grid-template-columns: minmax(400px, 1fr) var(--rb-page-width);
  gap: 14px;
  height: var(--rb-page-height);
  align-items: stretch;
  min-height: 0;
}
@media (max-width: 1100px) {
  .container.builder-container { padding: 12px; }
  .rb-screen {
    height: auto;
    min-height: 0;
  }
  .rb-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.rb-form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  height: var(--rb-page-height);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.rb-editor-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.rb-editor-head .rb-top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.rb-contact-section {
  flex: 0 0 auto;
  padding-bottom: 14px;
  margin-bottom: 12px;
}
.rb-contact-section .field + .field { margin-top: 10px; }
.rb-scroll-sections {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.rb-scroll-sections::-webkit-scrollbar { width: 8px; }
.rb-scroll-sections::-webkit-scrollbar-track { background: transparent; }
.rb-scroll-sections::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.rb-section {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.rb-section:last-child { border-bottom: none; margin-bottom: 0; }
.rb-section h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin: 0 0 10px;
}
.rb-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.rb-section-header h3 { margin: 0; }

.rb-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
@media (max-width: 600px) {
  .rb-grid-2 { grid-template-columns: 1fr; }
}

.rb-role-card,
.rb-edu-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
.rb-role-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.rb-role-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.rb-role-tools { display: flex; gap: 4px; }
.rb-role-tools button {
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1;
}

.rb-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
}
.rb-date-range input { flex: 1 1 0; }
.rb-date-range span { color: var(--muted); }

.rb-bullet-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.rb-bullet-row textarea {
  flex: 1 1 auto;
  font-size: 13px;
  resize: vertical;
  min-height: 44px;
}
.rb-bullet-row button {
  flex-shrink: 0;
  align-self: flex-start;
  padding: 4px 8px;
  font-size: 14px;
  line-height: 1;
}

.rb-skill-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.rb-skill-label { max-width: 220px; flex: 0 0 auto; }
.rb-skill-value { flex: 1 1 auto; min-width: 0; }
.rb-skill-sep { color: var(--muted); }
.rb-skill-row button {
  flex-shrink: 0;
  padding: 4px 8px;
  font-size: 14px;
  line-height: 1;
}

.rb-edu-card .danger { margin-top: 4px; }

/* Preview pane */
.rb-preview-pane {
  justify-self: start;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  width: var(--rb-page-width);
  height: var(--rb-page-height);
  min-height: 0;
  overflow: hidden;
}
.rb-preview-iframe {
  display: block;
  width: var(--rb-page-width);
  height: var(--rb-page-height);
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

@media (max-width: 760px) {
  .rb-editor-head {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .rb-editor-head .rb-top-actions {
    justify-content: flex-start;
  }
  .rb-form,
  .rb-preview-pane,
  .rb-preview-iframe {
    height: var(--rb-page-height);
  }
}

/* ── PDF Preview Modal ──────────────────────────────────────────────────── */
.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.preview-modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: min(900px, 100%);
  height: min(88vh, 1100px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.preview-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
}
.preview-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.preview-download-btn {
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.preview-download-btn:hover { opacity: 0.88; }
.preview-modal-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-close-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.preview-close-btn:hover { color: var(--text); border-color: var(--muted); }
.preview-modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #525659;
}
.preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.preview-loading, .preview-error {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.preview-error { color: var(--bad); }

/* Fade transition for the overlay */
.fade-enter-active, .fade-leave-active { transition: opacity 0.18s ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

/* ── Edit button in preview modal ─────────────────────────────────────── */
.preview-edit-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.preview-edit-btn:hover:not(:disabled) { background: #232a36; border-color: #2f3744; }

/* ── Regenerate buttons ────────────────────────────────────────────────── */
.regen-btn {
  padding: 5px 8px;
  font-size: 13px;
  line-height: 1;
  border-radius: 999px;
  color: var(--muted);
  min-width: 28px;
}
.regen-btn:hover:not(:disabled) { color: var(--accent); border-color: rgba(79,158,255,0.4); }
