:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --text: #e8eef7;
  --muted: #9aa8bc;
  --accent: #3b82f6;
  --accent-2: #22c55e;
  --border: #2d3a4f;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.header {
  background: linear-gradient(135deg, #1e3a5f, #0f1419);
  border-bottom: 1px solid var(--border);
  padding: 2rem 0 1.5rem;
}

.header h1 { margin: 0 0 0.4rem; font-size: 1.9rem; }
.subtitle { margin: 0; color: var(--muted); }
.index-status { margin-top: 0.5rem; font-size: 0.92rem; }
.index-status code { font-size: 0.85rem; }

.layout { padding: 1.5rem 0 3rem; display: grid; gap: 1.25rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.panel h2 { margin-top: 0; font-size: 1.2rem; }
.hint { color: var(--muted); font-size: 0.92rem; }

.hidden { display: none !important; }

textarea, input[type="text"], input[type="number"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  font: inherit;
}

textarea { resize: vertical; min-height: 180px; }

.btn {
  margin-top: 1rem;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
}

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

.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.schema-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.schema-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem;
}

.schema-card h3 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.schema-card p { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.85rem; }

.badge {
  display: inline-block;
  background: #334155;
  color: #cbd5e1;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.9rem;
}

.filters-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.progress-bar {
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s ease;
}

#progress-text { color: var(--muted); }

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.candidate-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-top: 0.85rem;
}

.candidate-card header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
}

.candidate-card h3 { margin: 0; font-size: 1.05rem; }

.score {
  background: #14532d;
  color: #bbf7d0;
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.meta { color: var(--muted); font-size: 0.9rem; margin: 0.35rem 0; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }

.tag {
  background: #1e293b;
  border: 1px solid var(--border);
  color: #cbd5e1;
  font-size: 0.78rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.resume-preview {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.86rem;
}

a.resume-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

a.resume-link:hover { text-decoration: underline; }

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  padding: 0;
  margin-top: 0.65rem;
  text-decoration: underline;
}

.btn-link:hover { filter: brightness(1.15); }

.match-explanation {
  margin-top: 0.85rem;
  padding: 0.9rem 1rem;
  background: #111827;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.match-explanation h4 {
  margin: 0.85rem 0 0.4rem;
  font-size: 0.88rem;
  color: #cbd5e1;
}

.match-explanation h4:first-child {
  margin-top: 0;
}

.match-summary {
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: #e2e8f0;
}

.match-formula {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
}

.match-why {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.match-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  margin-bottom: 0.25rem;
}

.match-table th,
.match-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0.45rem;
  text-align: left;
  vertical-align: top;
}

.match-table th {
  color: #94a3b8;
  font-weight: 600;
}

.match-table .points {
  color: #86efac;
  font-weight: 600;
  white-space: nowrap;
}

.match-total td {
  border-top: 2px solid var(--border);
  font-weight: 600;
  color: #e2e8f0;
}

.match-pass {
  color: #86efac;
  font-weight: 600;
  font-size: 0.8rem;
}

.match-fail {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.8rem;
}

.error {
  color: var(--danger);
  margin-top: 0.75rem;
}

.extraction-summary {
  display: grid;
  gap: 1rem;
}

.extraction-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.extraction-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.extraction-block h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: #cbd5e1;
}

.extraction-block ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.extraction-block ul li {
  margin-bottom: 0.25rem;
}

.extraction-empty {
  color: var(--muted);
  font-size: 0.88rem;
  font-style: italic;
}

.meta-pill {
  background: #1e3a5f;
  color: #bfdbfe;
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.tag.required {
  border-color: #1d4ed8;
  background: #172554;
  color: #93c5fd;
}

.tag.preferred {
  border-color: #166534;
  background: #14532d;
  color: #bbf7d0;
}

.tag.soft {
  border-color: #6b21a8;
  background: #3b0764;
  color: #e9d5ff;
}
