* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0c1220;
  --bg-secondary: #111a2e;
  --bg-tertiary: #162038;
  --bg-hover: #1a2744;
  --border: #1e2d4a;
  --text-primary: #e4e8f0;
  --text-secondary: #8892a8;
  --text-dim: #5a6478;
  --accent: #00aaff;
  --accent-dim: #0077b3;
  --green: #22c55e;
  --yellow: #eab308;
  --orange: #f97316;
  --red: #ef4444;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  /* IMPORTANT: default is no-drag so clicks on table rows, list items, etc.
     actually fire. Only the sidebar header gets -webkit-app-region: drag so
     the user can still move the window by grabbing the VETT logo area. */
  -webkit-app-region: no-drag;
}

.sidebar-header {
  -webkit-app-region: drag;
  /* Interactive children (none currently, but if added later) must be no-drag */
}

.sidebar-header * {
  -webkit-app-region: no-drag;
}

.app {
  display: flex;
  height: 100vh;
}

/* ── Sidebar ── */

.sidebar {
  width: 340px;
  min-width: 340px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 40px;
}

.sidebar-header {
  margin-bottom: 4px;
}

.logo {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--accent);
}

.subtitle {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ── Mode Tabs ── */

.mode-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.mode-tab {
  flex: 1;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-tab:first-child {
  border-right: 1px solid var(--border);
}

.mode-tab.active {
  background: var(--accent);
  color: #fff;
}

.mode-tab:not(.active):hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.mode-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Forms ── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label,
.form-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
textarea {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

/* ── Buttons ── */

.btn {
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #0099e6;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.folder-path {
  font-size: 11px;
  color: var(--text-dim);
  word-break: break-all;
  margin-top: 4px;
}

.folder-path.active {
  color: var(--green);
}

/* ── CSV Info ── */

.csv-info {
  background: var(--bg-tertiary);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.csv-stat {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.csv-stat-label {
  color: var(--text-secondary);
}

.csv-stat-value {
  color: var(--text-primary);
  font-weight: 600;
}

.csv-stat-value.filtered {
  color: var(--red);
}

.csv-questions-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.csv-questions-list {
  list-style: none;
  padding: 0;
  background: var(--bg-tertiary);
  border-radius: 6px;
  padding: 8px 10px;
  max-height: 120px;
  overflow-y: auto;
}

.csv-questions-list li {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 3px 0;
  padding-left: 10px;
  position: relative;
  line-height: 1.4;
}

.csv-questions-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Filter ── */

.filter-group {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.filter-group label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

/* ── Progress ── */

.progress-section {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.progress-bar-container {
  background: var(--bg-tertiary);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ── Content area ── */

.content {
  flex: 1;
  overflow-y: auto;
  padding: 30px;
  padding-top: 40px;
  position: relative;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  text-align: center;
  gap: 16px;
}

.empty-icon {
  font-size: 48px;
  opacity: 0.3;
}

.empty-state p {
  max-width: 320px;
  font-size: 14px;
  line-height: 1.6;
}

/* ── Results ── */

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.results-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.results-actions {
  display: flex;
  gap: 8px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.results-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-primary);
}

.results-table tbody tr {
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s;
}

.results-table tbody tr:hover {
  background: var(--bg-hover);
  box-shadow: inset 3px 0 0 var(--accent);
}

.results-table tbody tr:hover td.col-name {
  color: var(--accent);
}

.results-table tbody tr:active {
  background: var(--bg-tertiary);
}

.results-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.col-rank { width: 40px; }
.col-score { width: 70px; }
.col-name { width: 180px; }
.col-role { width: 200px; color: var(--text-secondary); }
.col-highlights { color: var(--text-secondary); }

td.col-role { color: var(--text-secondary); }
td.col-highlights { color: var(--text-secondary); font-size: 12px; }

.score-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  display: inline-block;
  min-width: 36px;
  text-align: center;
}

.score-green { color: var(--green); }
.score-yellow { color: var(--yellow); }
.score-orange { color: var(--orange); }
.score-red { color: var(--red); }

.row-error td {
  color: var(--text-dim);
  font-style: italic;
}

/* ── Pre-filtered Section ── */

.prefiltered-section {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.prefiltered-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.prefiltered-table tbody tr {
  opacity: 0.45;
  cursor: pointer;
}

.prefiltered-table tbody tr:hover {
  opacity: 0.7;
  background: var(--bg-hover);
}

.prefiltered-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--red);
  background: rgba(239, 68, 68, 0.12);
  padding: 2px 6px;
  border-radius: 3px;
}

/* ── Detail Panel ── */

.detail-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 480px;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  padding: 30px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: -4px 0 24px rgba(0,0,0,0.4);
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.detail-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  -webkit-app-region: no-drag;
}

.detail-close:hover {
  color: var(--text-primary);
}

.detail-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.detail-role {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.detail-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.detail-meta span {
  margin-right: 16px;
}

.detail-score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.detail-score-big {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 800;
}

.detail-score-label {
  font-size: 12px;
  color: var(--text-dim);
}

.detail-score-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.detail-score-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.detail-section {
  margin-bottom: 18px;
}

.detail-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 6px;
  cursor: default;
}

.detail-section-title.collapsible {
  cursor: pointer;
  user-select: none;
}

.detail-section-title.collapsible::before {
  content: '\25B6';
  display: inline-block;
  margin-right: 6px;
  font-size: 9px;
  transition: transform 0.15s;
}

.detail-section-title.collapsible.expanded::before {
  transform: rotate(90deg);
}

.detail-section p,
.detail-section li {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.detail-section ul {
  list-style: none;
  padding: 0;
}

.detail-section li {
  padding: 3px 0;
  padding-left: 14px;
  position: relative;
}

.detail-section li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.detail-section.gaps li::before { background: var(--yellow); }
.detail-section.red-flags li::before { background: var(--red); }
.detail-section.questions li::before { background: var(--text-dim); }
.detail-section.qa-section li::before { background: var(--accent-dim); }

.qa-answer {
  color: var(--text-primary);
  font-weight: 600;
}

.detail-filtered-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--red);
  background: rgba(239, 68, 68, 0.12);
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 16px;
}

/* ── Detail Contact ── */

.detail-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ── Q&A Grid in Detail ── */

.qa-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qa-row {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border-radius: 6px;
}

.qa-q {
  font-size: 11px;
  color: var(--text-dim);
}

.qa-a {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* ══════════════════════════════════════════════════════════════════════════
   NEW COMPONENTS for D1-backed workflow
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Primary actions + view tabs ── */

.primary-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.primary-actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-icon {
  font-size: 14px;
  opacity: 0.9;
}

.view-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.view-tab {
  flex: 1;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.view-tab:first-child {
  border-right: 1px solid var(--border);
}

.view-tab.active {
  background: var(--accent);
  color: #fff;
}

.view-tab:not(.active):hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.view-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding-top: 6px;
}

.section-label .count {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 1px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
}

.hint {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  padding-bottom: 4px;
}

/* ── Positions list ── */

.positions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list-empty {
  padding: 20px 12px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.5;
  background: var(--bg-tertiary);
  border-radius: 6px;
}

.position-item {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-app-region: no-drag;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.position-item:hover {
  border-color: var(--accent-dim);
  background: var(--bg-hover);
}

.position-item.active {
  border-color: var(--accent);
  background: var(--bg-hover);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.position-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.position-item-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.position-item-id {
  background: var(--bg-primary);
  padding: 1px 6px;
  border-radius: 3px;
}

.position-item-dot {
  opacity: 0.5;
}

.position-item-stats {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-secondary);
}

.position-item-stats strong {
  color: var(--text-primary);
  font-weight: 700;
}

.shortlisted-stat {
  color: var(--yellow);
  font-weight: 600;
}

.hired-stat {
  color: var(--green);
  font-weight: 600;
}

/* ── Position header (main content) ── */

.position-view {
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.position-header {
  margin-bottom: 20px;
}

.position-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.position-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.id-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  background: var(--bg-tertiary);
  color: var(--text-dim);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.position-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Action bar ── */

.action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  margin-bottom: 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.action-spacer { flex: 1; }

.btn.linked {
  border-color: var(--green);
  color: var(--green);
}

.filter-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}

.filter-inline input[type="range"] {
  width: 120px;
}

.filter-inline span {
  display: inline-block;
  min-width: 20px;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* ── Filter questions details ── */

.filter-questions-details {
  margin-bottom: 14px;
  font-size: 12px;
}

.filter-questions-details summary {
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px 0;
  user-select: none;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
}

.filter-questions-details summary:hover {
  color: var(--accent);
}

.filter-questions-details summary .count {
  display: inline-block;
  background: var(--bg-tertiary);
  color: var(--text-dim);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-family: var(--font-mono);
  margin-left: 6px;
}

.filter-questions-list {
  list-style: none;
  padding: 10px 14px;
  margin-top: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.filter-questions-list li {
  padding: 4px 0;
  padding-left: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  position: relative;
}

.filter-questions-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Candidate table extensions ── */

.col-status { width: 130px; }
.col-star { width: 40px; text-align: center; }

.star-toggle {
  cursor: pointer;
  font-size: 18px;
  color: var(--text-dim);
  transition: all 0.15s;
  user-select: none;
}

.star-toggle.on {
  color: var(--yellow);
}

.star-toggle:hover {
  transform: scale(1.2);
  color: var(--yellow);
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  white-space: nowrap;
}

.status-pill.status-shortlisted {
  background: rgba(0, 170, 255, 0.15);
  color: var(--accent);
}

.status-pill.status-hired {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.status-pill.status-passed,
.status-pill.status-declined,
.status-pill.status-ghosted {
  background: var(--bg-tertiary);
  color: var(--text-dim);
}

.status-pill.status-deal-breaker {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

.row-hired td {
  background: rgba(34, 197, 94, 0.05);
}

.row-shortlisted td {
  background: rgba(0, 170, 255, 0.04);
}

.row-dealbreaker td {
  opacity: 0.5;
}

.row-decided td {
  opacity: 0.5;
}

.score-dim {
  color: var(--text-dim);
}

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

/* ── Detail panel actions ── */

.detail-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

/* ── Toast ── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  min-width: 260px;
  max-width: 420px;
  padding: 12px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 200;
  -webkit-app-region: no-drag;
  animation: toastIn 0.2s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-success { border-left-color: var(--green); }
.toast-error   { border-left-color: var(--red); }
.toast-info    { border-left-color: var(--accent); }

/* ── Busy state ── */

body.busy {
  cursor: wait;
}

body.busy .btn:disabled {
  opacity: 0.4;
}

/* ══════════════════════════════════════════════════════════════════════════
   Interview timeline, decisions, add-step form, search results
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Decision buttons ── */

.decision-row {
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  margin-bottom: 20px;
}

.decision-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.decision-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.decision-btn {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.decision-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.decision-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.decision-btn.active.hired {
  background: var(--green);
  border-color: var(--green);
}

.decision-btn.active.passed {
  background: var(--text-dim);
  border-color: var(--text-dim);
}

.decision-btn.decision-reopen {
  margin-left: auto;
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Interview timeline ── */

.timeline-section {
  padding: 14px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.timeline-empty {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  padding: 8px 0;
  margin: 0;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 70px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 66px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-tertiary);
  z-index: 1;
}

.timeline-item.outcome-pass::before { background: var(--green); }
.timeline-item.outcome-fail::before { background: var(--red); }
.timeline-item.outcome-no_show::before { background: var(--orange); }
.timeline-item.outcome-rescheduled::before { background: var(--yellow); }
.timeline-item.outcome-pending::before { background: var(--text-dim); }

.timeline-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  width: 70px;
  text-align: right;
  flex-shrink: 0;
  padding-top: 3px;
}

.timeline-content {
  flex: 1;
  padding-left: 18px;
  min-width: 0;
}

.timeline-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--text-primary);
}

.outcome-pill {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.outcome-pill.outcome-pass { background: rgba(34,197,94,0.15); color: var(--green); }
.outcome-pill.outcome-fail { background: rgba(239,68,68,0.15); color: var(--red); }
.outcome-pill.outcome-no_show { background: rgba(249,115,22,0.15); color: var(--orange); }
.outcome-pill.outcome-rescheduled { background: rgba(234,179,8,0.15); color: var(--yellow); }
.outcome-pill.outcome-pending { background: var(--bg-secondary); color: var(--text-dim); }

.timeline-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.timeline-delete:hover {
  color: var(--red);
}

.timeline-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.timeline-notes {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Add step form ── */

.add-step-form {
  margin-top: 10px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-step-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.add-step-form select,
.add-step-form input[type="date"],
.add-step-form input[type="text"],
.add-step-form textarea {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  outline: none;
  width: 100%;
}

.add-step-form label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 2px;
  display: block;
}

.add-step-form .form-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}

/* ── Search results ── */

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-result {
  text-align: left;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-app-region: no-drag;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-sans);
}

.search-result:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.search-result-row1 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-result-rank {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  min-width: 22px;
}

.search-result-name {
  font-size: 14px;
  font-weight: 700;
  flex: 1;
  color: var(--text-primary);
}

.search-result-row2 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.search-result-dot { opacity: 0.4; }

.search-result-position {
  color: var(--text-secondary);
  font-weight: 600;
}

.search-result-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 6px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-radius: 4px;
  font-family: var(--font-mono);
}

.search-result-snippet mark {
  background: rgba(0, 170, 255, 0.25);
  color: var(--accent);
  padding: 0 2px;
  border-radius: 2px;
}

/* ══════════════════════════════════════════════════════════════════════════
   Description editor modal
   ══════════════════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 18, 32, 0.78);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  -webkit-app-region: no-drag;
  animation: fadeOverlay 0.15s ease;
}

@keyframes fadeOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-width: 900px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0 6px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 18px 24px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-body .hint {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0 0 4px 0;
}

.modal-body textarea {
  width: 100%;
  flex: 1;
  min-height: 320px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

.modal-body textarea:focus {
  border-color: var(--accent);
}

.description-meta-row {
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  font-family: var(--font-mono);
}

.modal-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}

.modal-footer-spacer {
  flex: 1;
}

/* ══════════════════════════════════════════════════════════════════════════
   Inline-editable score + compact recruiter notes
   ══════════════════════════════════════════════════════════════════════════ */

.detail-score-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* The score input is styled to look like the old static .detail-score-big
   display — big number, monospace, color-coded — but is actually an editable
   input. Click to edit, blur to save. */
.detail-score-input {
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 6px;
  width: 90px;
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  outline: none;
  transition: background 0.15s, border-color 0.15s;
}

.detail-score-input::-webkit-inner-spin-button,
.detail-score-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.detail-score-input:hover {
  background: var(--bg-tertiary);
}

.detail-score-input:focus {
  background: var(--bg-primary);
  border-color: var(--accent);
}

.detail-score-input.manual-override {
  color: var(--yellow) !important;
}

.score-override-note {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-left: 4px;
}

.score-override-note a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.score-override-note a:hover {
  color: var(--text-primary);
}

.save-status {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.2s;
  margin-left: 8px;
}

.save-status.visible {
  opacity: 1;
}

.save-status.saving { color: var(--text-dim); }
.save-status.saved  { color: var(--green); }
.save-status.error  { color: var(--red); }

/* ── Compact recruiter notes section ── */

.notes-compact {
  margin-bottom: 18px;
}

.notes-compact-textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  min-height: 72px;
}

.notes-compact-textarea:focus {
  border-color: var(--accent);
}

/* ══════════════════════════════════════════════════════════════════════════
   Faceted search filters (sidebar)
   ══════════════════════════════════════════════════════════════════════════ */

.reset-filters-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  padding: 0;
}

.reset-filters-link:hover {
  color: var(--text-primary);
}

.filter-compact-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.filter-compact-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-compact-group label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.filter-compact-group input[type="number"] {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-mono);
  outline: none;
  width: 100%;
}

.filter-compact-group input[type="number"]:focus {
  border-color: var(--accent);
}

.filter-compact-group input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.filter-toggle input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

#filterDecision,
#filterPosition {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  outline: none;
  width: 100%;
  cursor: pointer;
}

#filterDecision:focus,
#filterPosition:focus {
  border-color: var(--accent);
}

.filter-section {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0;
  overflow: hidden;
}

.filter-section summary {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.filter-section summary::-webkit-details-marker {
  display: none;
}

.filter-section summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 6px;
  font-size: 8px;
  color: var(--text-dim);
  transition: transform 0.15s;
}

.filter-section[open] summary::before {
  transform: rotate(90deg);
}

.filter-section summary:hover {
  color: var(--text-primary);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 10px 10px 10px;
}

.filter-chip {
  -webkit-app-region: no-drag;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
}

.filter-chip:hover {
  border-color: var(--accent-dim);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ══════════════════════════════════════════════════════════════════════════
   Richer search result cards (role, years, location)
   ══════════════════════════════════════════════════════════════════════════ */

.search-result-role {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════════════
   Detail panel top bar: nav + prominent shortlist toggle
   ══════════════════════════════════════════════════════════════════════════ */

.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -8px -4px 18px -4px;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.detail-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-nav-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.detail-nav-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.detail-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.detail-nav-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  min-width: 56px;
  text-align: center;
}

/* Prominent shortlist toggle — fills right side of topbar */
.detail-shortlist-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: all 0.15s;
}

.detail-shortlist-toggle:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

.detail-shortlist-toggle.is-on {
  background: rgba(234, 179, 8, 0.15);
  border-color: var(--yellow);
  color: var(--yellow);
}

.detail-shortlist-star {
  font-size: 16px;
  line-height: 1;
}

.detail-shortlist-label {
  font-size: 11px;
}

/* Shortlist badge inline with the candidate name */
.detail-name-badge {
  display: inline-block;
  margin-left: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--yellow);
  background: rgba(234, 179, 8, 0.15);
  padding: 3px 8px;
  border-radius: 10px;
  vertical-align: middle;
}

/* ── Web-only additions ── */
.user-badge {
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.user-badge .user-email { font-family: var(--font-mono); font-size: 11px; }
.user-badge .user-email.error { color: var(--red); }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-footer .hint { font-size: 11px; color: var(--text-dim); line-height: 1.5; margin: 0; }
body { -webkit-app-region: unset; }
