:root {
  --md-sys-color-primary: #064e3b;
  --md-sys-color-on-primary: #f3fff7;
  --md-sys-color-primary-container: #b8f2d8;
  --md-sys-color-on-primary-container: #022c22;
  --md-sys-color-secondary: #9a3412;
  --md-sys-color-surface: #fefcf6;
  --md-sys-color-surface-container: #fff5e8;
  --md-sys-color-on-surface: #212121;
  --md-sys-color-outline: #8a8a8a;
  --md-sys-shape-corner-large: 28px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--md-sys-color-on-surface);
  background:
    radial-gradient(circle at 10% 10%, #d9fff0 0%, transparent 35%),
    radial-gradient(circle at 90% 0%, #ffe2cf 0%, transparent 40%),
    linear-gradient(145deg, #fffdf8, #f7f9ff);
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.45;
  pointer-events: none;
}

.bg-shape-a {
  width: 320px;
  height: 320px;
  background: #8de1b8;
  top: -110px;
  left: -80px;
}

.bg-shape-b {
  width: 260px;
  height: 260px;
  background: #ffbc93;
  right: -80px;
  bottom: 15%;
}

.app-shell {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 2.2rem 0 3rem;
  animation: reveal 500ms ease-out;
}

.hero h1 {
  margin: 0.2rem 0 0;
  font-family: "Fraunces", serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: -0.02em;
}

.eyebrow {
  display: inline-block;
  margin: 0;
  padding: 0.25rem 0.65rem;
  border: 1px solid #0f766e;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #0f766e;
}

.subtitle {
  margin-top: 0.9rem;
  max-width: 64ch;
  line-height: 1.5;
  color: #3f3f46;
}

.controls {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  margin-top: 1.5rem;
  padding: 1.2rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(12, 74, 57, 0.11);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.2rem;
  font-weight: 500;
}

.actions {
  display: flex;
  gap: 0.8rem;
  grid-column: span 2;
}

.undo-actions {
  display: flex;
  gap: 0.8rem;
  grid-column: span 2;
  flex-wrap: wrap;
}

.context-filters {
  grid-column: span 2;
  margin-top: 0.2rem;
  padding: 0.75rem;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.profile-filters {
  grid-column: span 2;
  margin-top: 0.2rem;
  padding: 0.75rem;
  border-radius: 14px;
  background: rgba(236, 253, 245, 0.7);
  border: 1px solid rgba(6, 78, 59, 0.14);
}

.profile-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.switch-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: #334155;
}

.context-filters-label {
  margin: 0;
  font-weight: 700;
  font-size: 0.9rem;
}

.context-filter-group {
  margin-top: 0.5rem;
}

.context-filter-title {
  display: inline-block;
  font-size: 0.82rem;
  color: #4b5563;
  margin-bottom: 0.2rem;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  border: 0;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.chip-badge {
  border-radius: 999px;
  padding: 0.03rem 0.3rem;
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.chip-kind {
  background: rgba(255, 255, 255, 0.6);
}

.chip-predicate {
  background: rgba(15, 118, 110, 0.18);
}

.chip-label {
  line-height: 1.1;
}

.chip-remove {
  margin-left: 0.1rem;
  opacity: 0.8;
}

.filter-chip-include {
  background: #d1fae5;
  color: #065f46;
}

.filter-chip-exclude {
  background: #fee2e2;
  color: #991b1b;
}

.filter-chip-source-saved {
  box-shadow: inset 0 0 0 1px rgba(6, 78, 59, 0.16);
}

.stats {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 0.9rem;
}

.stat-card {
  border-radius: 18px;
  background: var(--md-sys-color-surface-container);
  border: 1px solid rgba(0, 0, 0, 0.07);
  padding: 1rem;
}

.stat-card h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(1.7rem, 2.8vw, 2.4rem);
}

.stat-card p {
  margin: 0.25rem 0 0;
}

.result-grid {
  margin-top: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#result-tabs {
  align-self: flex-start;
  border-radius: 999px;
  background: var(--md-sys-color-surface-container);
  --md-primary-tab-container-shape: 999px;
  --md-primary-tab-container-color: transparent;
}

.result-grid > article {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  padding: 0.8rem;
}

.job-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.55rem;
  max-height: 640px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.4rem;
}

.job-card {
  min-width: 0;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0.7rem;
  box-shadow: 0 12px 25px -22px rgba(0, 0, 0, 0.5);
  transform: translateY(8px);
  opacity: 0;
  animation: settle 350ms ease-out forwards;
}

.job-card h4 {
  margin: 0;
  font-size: 0.98rem;
}

.job-card h4 a {
  color: inherit;
  text-decoration: none;
}

.job-card h4 a:hover {
  text-decoration: underline;
}

.filterable-fragment,
.job-card h4 a {
  cursor: context-menu;
}

.filterable-fragment:hover,
.job-card h4 a:hover {
  text-decoration: underline;
  text-decoration-style: dotted;
}

.job-card p {
  margin: 0.35rem 0 0;
  color: #4b5563;
  font-size: 0.9rem;
}

.trace {
  margin-top: 0.45rem;
  color: #374151;
  font-size: 0.82rem;
  line-height: 1.35;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}

.source-badge {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: #0f766e;
}

.federal-contractor-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.06rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(6, 78, 59, 0.12);
  color: #064e3b;
}

.location-chip-row,
.claim-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
  min-width: 0;
}

.location-chip,
.claim-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.74rem;
  line-height: 1.2;
  background: rgba(15, 23, 42, 0.05);
  color: #1f2937;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.location-chip-full {
  font-weight: 600;
}

.job-claims-group-label {
  display: block;
  margin-top: 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.claim-chip-verified,
.claim-chip-high_confidence {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(6, 95, 70, 0.22);
  color: #065f46;
}

.claim-chip-provisional,
.claim-chip-ambiguous {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(146, 64, 14, 0.24);
  color: #92400e;
}

.claim-chip-conflicted,
.claim-chip-rejected {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(153, 27, 27, 0.24);
  color: #991b1b;
}

.claim-chip-unknown {
  background: rgba(100, 116, 139, 0.12);
  border-color: rgba(71, 85, 105, 0.2);
  color: #334155;
}

.claim-chip-industry-profile {
  background: rgba(2, 132, 199, 0.12);
  border-color: rgba(2, 132, 199, 0.24);
  color: #075985;
}

.parent-company-line {
  font-size: 0.86rem;
}

.decision-note {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  border-radius: 8px;
  padding: 0.3rem 0.45rem;
  background: rgba(100, 116, 139, 0.1);
  color: #334155;
}

.job-description {
  white-space: pre-wrap;
  font-size: 0.85rem;
  color: #374151;
  max-height: 160px;
  overflow: auto;
  border-top: 1px dashed rgba(0, 0, 0, 0.12);
  padding-top: 0.45rem;
  margin-top: 0.6rem;
}

.soc-fit {
  margin-top: 0.35rem;
  font-size: 0.76rem;
  line-height: 1.35;
  border-radius: 8px;
  padding: 0.3rem 0.45rem;
  border: 1px solid transparent;
}

.soc-fit-aligned {
  color: #065f46;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(6, 95, 70, 0.22);
}

.soc-fit-possible_mismatch {
  color: #92400e;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(146, 64, 14, 0.28);
}

.soc-fit-insufficient_evidence {
  color: #1f2937;
  background: rgba(71, 85, 105, 0.12);
  border-color: rgba(71, 85, 105, 0.22);
}

.empty {
  border: 1px dashed rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 0.8rem;
  color: #4b5563;
  font-size: 0.9rem;
}

.context-menu {
  position: fixed;
  z-index: 20;
  min-width: 260px;
  max-width: 360px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  padding: 0.25rem;
}

.context-menu button {
  display: block;
  width: 100%;
  margin-top: 0.08rem;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.context-menu button:hover {
  background: #f1f5f9;
}

.menu-item-title {
  display: block;
  font-size: 0.85rem;
}

.hidden {
  display: none;
}

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

@keyframes settle {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 840px) {
  .controls,
  .stats {
    grid-template-columns: 1fr;
  }

  .actions {
    grid-column: auto;
    flex-wrap: wrap;
  }

  .context-filters {
    grid-column: auto;
  }

  .profile-filters {
    grid-column: auto;
  }

  .profile-header-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
