/* ── Layout ── */
.site-header { padding: 0.5rem 1.5rem; border-bottom: 1px solid var(--muted-border-color); }
.site-main { padding: 1.5rem; }
.nav-active { font-weight: 700; }
.logo { text-decoration: none; color: var(--color); }

/* ── Flash messages ── */
.flash { padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.875rem; }
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Stage badges ── */
.stage-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.stage-large { font-size: 0.85rem; padding: 4px 12px; }
.stage-sourced     { background: #f3f4f6; color: #6b7280; }
.stage-scored      { background: #dbeafe; color: #1e40af; }
.stage-selected    { background: #fce7f3; color: #9d174d; }
.stage-cv-ready    { background: #ede9fe; color: #5b21b6; }
.stage-applied     { background: #fef3c7; color: #92400e; }
.stage-interview   { background: #fef9c3; color: #713f12; border: 1px solid #fde047; }
.stage-offer       { background: #d1fae5; color: #065f46; }
.stage-negotiating { background: #ccfbf1; color: #0f766e; }
.stage-accepted    { background: #bbf7d0; color: #14532d; font-weight: 700; }
.stage-rejected    { background: #fee2e2; color: #991b1b; }
.stage-withdrawn   { background: #f3f4f6; color: #9ca3af; text-decoration: line-through; }
.stage-expired     { background: #e2e8f0; color: #475569; font-style: italic; }

/* ── Fit score badges ── */
.fit-badge {
  display: inline-block;
  min-width: 34px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.875rem;
}
.fit-high { background: #d1fae5; color: #065f46; }
.fit-mid  { background: #fef3c7; color: #92400e; }
.fit-low  { background: #fee2e2; color: #991b1b; }
.fit-big  { font-size: 1.75rem; min-width: 64px; padding: 6px 14px; border-radius: 10px; }

/* ── Cluster & tier badges ── */
.cluster-badge {
  background: #eff6ff;
  color: #1e40af;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}
.tier-badge {
  background: #f5f3ff;
  color: #5b21b6;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ── Pipeline layout ── */
.pipeline-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.filters-sidebar {
  background: var(--card-background-color, #fff);
  border: 1px solid var(--muted-border-color, #e0e0e0);
  border-radius: 8px;
  padding: 1rem;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}
.filter-section { margin-bottom: 1rem; }
.filter-section strong { display: block; font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted-color); margin-bottom: 0.4rem; }
.filter-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0;
  font-size: 0.8rem;
  cursor: pointer;
}
.filter-check input[type="checkbox"] { margin: 0; width: 1rem; height: 1rem; }
.count-pill {
  background: var(--muted-border-color, #e0e0e0);
  color: var(--muted-color);
  border-radius: 10px;
  padding: 0 5px;
  font-size: 0.7rem;
  margin-left: auto;
}

.pipeline-main { min-width: 0; }
.pipeline-header { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; }
.table-wrap { overflow-x: auto; }
table { font-size: 0.82rem; }
table a { text-decoration: none; color: var(--primary); }
table a:hover { text-decoration: underline; }

/* ── Row selection ── */
.sel-col { width: 1.6rem; text-align: center; padding-left: 0.3rem; padding-right: 0.3rem; }
.sel-box { margin: 0; width: 1rem; height: 1rem; cursor: pointer; vertical-align: middle; }
/* Per-row checkbox hidden until hover, or when checked, or when the table has
   any active selection (so you can see what you picked while scrolling). */
td.sel-col .row-sel { opacity: 0; transition: opacity 0.1s; }
tr:hover td.sel-col .row-sel,
td.sel-col .row-sel:checked,
.has-selection td.sel-col .row-sel { opacity: 1; }

.selection-bar {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--primary, #1e40af);
  color: #fff;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  z-index: 50;
}
.selection-bar .sel-count { font-size: 0.85rem; }
.selection-bar .btn-sm { margin: 0; }
.selection-bar .btn-sm.secondary.outline { --pico-color: #fff; border-color: rgba(255,255,255,0.6); color: #fff; }

/* ── JobsDB link button (pipeline) ── */
.jobsdb-btn {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  background: #eef2ff;
  color: #1e40af !important;
  border: 1px solid #c7d2fe;
  text-decoration: none !important;
}
.jobsdb-btn:hover { background: #1e40af; color: #fff !important; }

/* ── Table extras ── */
.brand-star { color: #f59e0b; font-size: 0.75rem; margin-left: 3px; }
.ic-tag { background: #f0fdf4; color: #166534; font-size: 0.65rem; padding: 1px 5px;
  border-radius: 4px; margin-left: 3px; }
.lang-nogo { background: #fee2e2; color: #991b1b; font-size: 0.65rem; font-weight: 600;
  padding: 1px 5px; border-radius: 4px; margin-left: 3px; white-space: nowrap; }

/* ── Inline stage dropdown (pipeline table) ── */
.stage-select-form { margin: 0; }
.nowrap { white-space: nowrap; }
.stage-mini-select {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 22px 2px 9px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  height: auto;
  min-height: 0;
  line-height: 1.4;
  margin: 0;
  width: auto;
  background-position: right 6px center;
  background-size: 12px;
  --pico-form-element-spacing-vertical: 0;
  --pico-form-element-spacing-horizontal: 0;
}
/* mini-select shares the stage badge colours */
.stage-mini-select.stage-sourced     { background-color: #f3f4f6; color: #6b7280; }
.stage-mini-select.stage-scored      { background-color: #dbeafe; color: #1e40af; }
.stage-mini-select.stage-selected    { background-color: #fce7f3; color: #9d174d; }
.stage-mini-select.stage-cv-ready    { background-color: #ede9fe; color: #5b21b6; }
.stage-mini-select.stage-applied     { background-color: #fef3c7; color: #92400e; }
.stage-mini-select.stage-interview   { background-color: #fef9c3; color: #713f12; }
.stage-mini-select.stage-offer       { background-color: #d1fae5; color: #065f46; }
.stage-mini-select.stage-negotiating { background-color: #ccfbf1; color: #0f766e; }
.stage-mini-select.stage-accepted    { background-color: #bbf7d0; color: #14532d; }
.stage-mini-select.stage-rejected    { background-color: #fee2e2; color: #991b1b; }
.stage-mini-select.stage-withdrawn   { background-color: #f3f4f6; color: #9ca3af; }
.stage-mini-select.stage-expired     { background-color: #e2e8f0; color: #475569; }

.file-links a { margin-right: 0.6rem; text-decoration: none; font-weight: 600; }
.file-links .text-muted { font-size: 0.72rem; }

/* ── Tab navigation ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--muted-border-color, #e0e0e0);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 0.5rem 1.1rem;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-color, #6b7280);
  text-decoration: none;
  transition: color 0.1s, border-color 0.1s;
}
.tab-btn:hover { color: var(--color); }
.tab-btn.active {
  border-bottom-color: var(--primary, #1e40af);
  color: var(--primary, #1e40af);
  font-weight: 600;
}

/* ── Job header ── */
.job-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.job-header h1 { font-size: 1.4rem; }
.job-header-badges { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.job-meta { font-size: 0.9rem; margin: 0; }
.breadcrumb { font-size: 0.8rem; color: var(--muted-color); margin-bottom: 1rem; }
.breadcrumb a { color: var(--muted-color); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ── Tab body ── */
.tab-body { padding: 0.25rem 0; }

/* ── Prominent "open original posting" CTA ── */
.view-original {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  width: 100%;
  margin: 0 0 1rem 0;
  padding: 0.85rem 1.1rem;
  background: var(--primary, #1e40af);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: filter 0.1s;
}
.view-original:hover { filter: brightness(1.08); color: #fff; }
.view-original small { font-weight: 500; opacity: 0.9; font-size: 0.8rem; }

/* ── Score card ── */
.score-card {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  background: var(--card-background-color, #f9fafb);
  border: 1px solid var(--muted-border-color, #e0e0e0);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.score-number {
  font-size: 2.5rem;
  font-weight: 800;
  min-width: 64px;
  text-align: center;
  padding: 6px 12px;
  border-radius: 10px;
}
.score-meta { font-size: 0.8rem; color: var(--muted-color); text-align: center; margin-top: 4px; }
.score-reason { font-size: 0.875rem; line-height: 1.6; flex: 1; }

/* ── Tags ── */
.tag-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.tag {
  background: var(--muted-border-color, #e0e0e0);
  color: var(--muted-color, #555);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 500;
}
.tag-good { background: #d1fae5; color: #065f46; }
.tag-warn { background: #fee2e2; color: #991b1b; }
.tag-brand { background: #fef3c7; color: #92400e; }

/* ── Info blocks ── */
.info-block {
  background: var(--card-background-color, #f9fafb);
  border: 1px solid var(--muted-border-color, #e0e0e0);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.info-block strong { display: block; margin-bottom: 0.4rem; }
.apply-grid, .meta-grid { display: flex; flex-wrap: wrap; gap: 0.3rem 1.5rem; }
.apply-grid span, .meta-grid span { font-size: 0.82rem; }

/* ── Description ── */
.description-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  line-height: 1.65;
  padding: 0.75rem;
  background: var(--code-background-color, #f6f8fa);
  border-radius: 6px;
  margin-top: 0.5rem;
  max-height: 500px;
  overflow-y: auto;
}
.teaser { font-style: italic; margin-bottom: 0.75rem; }

/* ── Application tab ── */
.stage-control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--card-background-color, #f9fafb);
  border: 1px solid var(--muted-border-color, #e0e0e0);
  border-radius: 8px;
}
.stage-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Email thread ── */
.email-item {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 6px;
}
.email-header { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap;
  margin-bottom: 0.25rem; }
.email-type-badge {
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}
.email-confirmation { background: #d1fae5; color: #065f46; }
.email-rejection    { background: #fee2e2; color: #991b1b; }
.email-interview_invite { background: #fef3c7; color: #92400e; }
.email-offer        { background: #bbf7d0; color: #14532d; }
.email-other        { background: #e5e7eb; color: #374151; }
.email-snippet { margin-top: 0.25rem; }

/* ── CV tab ── */
.cv-card { margin-bottom: 1rem; }
.cv-active { border-left: 3px solid var(--primary, #1e40af); }
.research-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  background: var(--code-background-color, #f6f8fa);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  margin-top: 0.4rem;
  max-height: 300px;
  overflow-y: auto;
}

/* ── Interview tab ── */
.interview-card { margin-bottom: 1rem; }
.outcome-badge {
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
}
.outcome-pending  { background: #e5e7eb; color: #6b7280; }
.outcome-passed   { background: #d1fae5; color: #065f46; }
.outcome-rejected { background: #fee2e2; color: #991b1b; }

/* ── Offer tab ── */
.offer-card { margin-bottom: 1rem; }
.offer-grid { display: flex; gap: 2rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.offer-value { font-size: 1.5rem; font-weight: 700; }
.offer-label { font-size: 0.75rem; color: var(--muted-color); text-transform: uppercase;
  letter-spacing: 0.05em; }

/* ── Dashboard ── */
.stat-cards { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stat-card {
  flex: 1;
  min-width: 100px;
  background: var(--card-background-color, #f9fafb);
  border: 1px solid var(--muted-border-color, #e0e0e0);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.75rem; color: var(--muted-color); text-transform: uppercase;
  letter-spacing: 0.05em; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.funnel-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.funnel-label { width: 130px; text-align: right; font-size: 0.8rem; flex-shrink: 0; }
.funnel-bar-wrap { flex: 1; background: var(--muted-border-color, #e0e0e0);
  border-radius: 4px; height: 18px; }
.funnel-bar { height: 100%; border-radius: 4px; min-width: 3px; }
.funnel-count { width: 36px; font-size: 0.8rem; font-weight: 600; text-align: right; }

/* Funnel bars use stage colours */
.funnel-bar.stage-sourced     { background: #d1d5db; }
.funnel-bar.stage-scored      { background: #93c5fd; }
.funnel-bar.stage-selected    { background: #f9a8d4; }
.funnel-bar.stage-cv-ready    { background: #c4b5fd; }
.funnel-bar.stage-applied     { background: #fcd34d; }
.funnel-bar.stage-interview   { background: #fbbf24; }
.funnel-bar.stage-offer       { background: #34d399; }
.funnel-bar.stage-negotiating { background: #2dd4bf; }
.funnel-bar.stage-accepted    { background: #10b981; }
.funnel-bar.stage-rejected    { background: #f87171; }
.funnel-bar.stage-withdrawn   { background: #9ca3af; }
.funnel-bar.stage-expired     { background: #94a3b8; }

/* ── Forms ── */
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ── Utility ── */
.text-muted { color: var(--muted-color, #6b7280); }
.small { font-size: 0.8rem; }
.note {
  background: var(--code-background-color, #f6f8fa);
  border: 1px solid var(--muted-border-color, #e0e0e0);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  font-size: 0.78rem;
  color: var(--muted-color, #555);
  margin-bottom: 1rem;
}
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
