:root {
  --app-bg: #111314;
  --app-surface: #171a1c;
  --app-surface-strong: #1f2326;
  --app-muted: #a7b0b5;
  --app-text: #eef2f3;
  --app-border: rgba(255, 255, 255, 0.12);
  --app-border-strong: rgba(255, 255, 255, 0.18);
  --app-accent: #4cc9b0;
  --app-accent-soft: rgba(76, 201, 176, 0.13);
  --app-warm: #f2b84b;
  --panel-border: var(--app-border);
}

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 16rem),
    var(--app-bg);
  color: var(--app-text);
  font-size: 0.95rem;
}

a {
  text-decoration: none;
}

.app-body {
  min-height: 100vh;
}

.app-main {
  max-width: 1500px;
  padding: 1.5rem;
}

.app-nav {
  background: rgba(17, 19, 20, 0.95);
  border-bottom: 1px solid var(--app-border);
}

.app-nav-inner {
  max-width: 1500px;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(76, 201, 176, 0.45);
  border-radius: 8px;
  background: var(--app-accent-soft);
  color: #9ff0dd;
  font-size: 0.82rem;
}

.app-nav-links {
  gap: 0.15rem;
}

.app-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  border-radius: 8px;
  color: var(--app-muted);
  padding-inline: 0.75rem;
}

.app-nav .nav-link:hover,
.app-nav .nav-link.active {
  background: rgba(255, 255, 255, 0.07);
  color: var(--app-text);
}

.app-company-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 18rem;
  border: 1px solid var(--app-border);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  color: var(--app-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.app-company-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: min(26rem, 100%);
  border: 1px solid var(--app-border);
  border-radius: 999px;
  padding: 0.25rem 0.35rem 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
}

.app-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--app-text);
  outline: 0;
}

.app-search input::placeholder {
  color: #7f898f;
}

.app-search button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 0;
  border-radius: 999px;
  background: var(--app-accent);
  color: #06221d;
}

.app-admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.page-header h1 {
  max-width: 64rem;
  margin: 0;
  font-size: clamp(1.65rem, 2.8vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.page-header p {
  max-width: 52rem;
  margin: 0.5rem 0 0;
  color: var(--app-muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.eyebrow,
.label {
  display: block;
  color: var(--app-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 0.45rem;
  color: #8fe7d4;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  color: var(--app-muted);
  font-size: 0.9rem;
}

.back-link:hover {
  color: var(--app-text);
}

.panel,
.metric {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12);
}

.metric {
  position: relative;
  padding: 1rem;
  min-height: 96px;
  overflow: hidden;
}

a.metric {
  color: inherit;
}

.metric-action {
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.metric-action:hover {
  border-color: var(--app-border-strong);
  background: rgba(255, 255, 255, 0.055);
  transform: translateY(-1px);
}

.metric-action > i {
  position: absolute;
  top: 0.95rem;
  right: 1rem;
  color: rgba(76, 201, 176, 0.82);
  font-size: 1.1rem;
}

.metric span {
  display: block;
  padding-right: 1.6rem;
  color: var(--app-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.metric strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.6rem;
  line-height: 1.1;
}

.metric small {
  display: block;
  margin-top: 0.55rem;
  color: var(--app-muted);
  font-size: 0.78rem;
}

.context-strip {
  border: 1px solid rgba(76, 201, 176, 0.22);
  border-radius: 8px;
  background: var(--app-accent-soft);
  padding: 1rem;
}

.filter-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(242, 184, 75, 0.09);
  border-color: rgba(242, 184, 75, 0.28);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.section-head h2 {
  font-size: 1rem;
  margin: 0;
}

.score {
  display: block;
  font-size: 1.5rem;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-weight: 700;
}

.score-high {
  background: rgba(25, 135, 84, 0.22);
  color: #7ee2aa;
}

.score-mid {
  background: rgba(255, 193, 7, 0.2);
  color: #ffd86b;
}

.score-low {
  background: rgba(220, 53, 69, 0.18);
  color: #ff9aa5;
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(16rem, 1.6fr) repeat(5, minmax(8.5rem, 1fr)) auto;
  align-items: end;
  gap: 0.75rem;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 1rem;
}

.compact-filter {
  grid-template-columns: minmax(18rem, 35rem) auto;
  justify-content: start;
}

.filter-search {
  min-width: 0;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
}

.filter-actions .btn {
  min-height: 2.35rem;
}

.input-with-icon {
  position: relative;
}

.input-with-icon > i {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  color: var(--app-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.input-with-icon .form-control {
  padding-left: 2.25rem;
}

.form-label {
  color: var(--app-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.raw-text {
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--app-muted);
  margin-bottom: 0;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  padding: 1rem;
  font-size: 0.85rem;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--app-text);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.045);
  --bs-table-border-color: var(--app-border);
}

.table th {
  color: var(--app-muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
}

.table td,
.table th {
  padding: 0.78rem 0.9rem;
}

.opportunity-row {
  transition: background 120ms ease;
}

.table-title,
.opportunity-title a {
  color: var(--app-text);
  font-weight: 700;
}

.table-title:hover,
.opportunity-title a:hover {
  color: #9ff0dd;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
  margin-top: 0.25rem;
  color: var(--app-muted);
  font-size: 0.84rem;
}

.meta-line span {
  position: relative;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(76, 201, 176, 0.26);
  border-radius: 999px;
  background: rgba(76, 201, 176, 0.1);
  color: #a8f2e3;
  padding: 0.22rem 0.55rem;
  font-size: 0.8rem;
}

.deadline-cell {
  min-width: 8.5rem;
}

.deadline-chip,
.source-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.deadline-chip {
  min-width: 5.6rem;
  border: 1px solid var(--app-border);
  padding: 0.28rem 0.55rem;
}

.deadline-date {
  display: block;
  margin-top: 0.28rem;
  color: var(--app-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.deadline-chip.active {
  background: rgba(25, 135, 84, 0.18);
  border-color: rgba(25, 135, 84, 0.35);
  color: #8ee2b4;
}

.deadline-chip.due-soon {
  background: rgba(242, 184, 75, 0.16);
  border-color: rgba(242, 184, 75, 0.35);
  color: #f4cc75;
}

.deadline-chip.expired {
  background: rgba(220, 53, 69, 0.16);
  border-color: rgba(220, 53, 69, 0.35);
  color: #ff9aa5;
}

.deadline-chip.no-deadline {
  background: rgba(255, 255, 255, 0.055);
  color: var(--app-muted);
}

.source-pill {
  border: 1px solid rgba(76, 201, 176, 0.24);
  background: rgba(76, 201, 176, 0.09);
  color: #9ff0dd;
  padding: 0.28rem 0.6rem;
}

.status-pill {
  border: 1px solid var(--app-border);
  padding: 0.32rem 0.62rem;
}

.status-new {
  background: rgba(255, 255, 255, 0.055);
  color: #dce2e4;
}

.status-reviewing {
  background: rgba(13, 110, 253, 0.17);
  border-color: rgba(13, 110, 253, 0.36);
  color: #9fc4ff;
}

.status-qualified {
  background: rgba(25, 135, 84, 0.19);
  border-color: rgba(25, 135, 84, 0.38);
  color: #8ee2b4;
}

.status-rejected {
  background: rgba(220, 53, 69, 0.16);
  border-color: rgba(220, 53, 69, 0.35);
  color: #ff9aa5;
}

.status-needs-ai {
  background: rgba(242, 184, 75, 0.16);
  border-color: rgba(242, 184, 75, 0.35);
  color: #f4cc75;
}

.content-panel,
.sidebar-panel,
.distribution-panel,
.form-section {
  padding: 1rem;
}

.content-panel {
  padding: 1.25rem;
}

.prose {
  color: #dce2e4;
  line-height: 1.65;
}

.prose p:last-child {
  margin-bottom: 0;
}

.detail-header {
  align-items: flex-start;
}

.assessment-panel {
  border-color: rgba(76, 201, 176, 0.2);
}

.assessment-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.assessment-header h2 {
  margin: 0.18rem 0 0;
  font-size: 1.15rem;
}

.assessment-score {
  min-width: 3.5rem;
  min-height: 3.5rem;
  border-radius: 8px;
  font-size: 1.4rem;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.score-tile {
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 0.85rem;
}

.score-tile span {
  display: block;
  color: var(--app-muted);
  font-size: 0.78rem;
}

.score-tile strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.45rem;
  line-height: 1;
}

.assessment-copy {
  color: var(--app-muted);
  line-height: 1.6;
}

.lead-copy {
  color: var(--app-text);
  font-size: 1rem;
  font-weight: 600;
}

.assessment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
  color: var(--app-muted);
  font-size: 0.82rem;
}

.assessment-meta span {
  border: 1px solid var(--app-border);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.empty-state {
  text-align: center;
  color: var(--app-muted);
  padding: 2rem 1rem;
}

.empty-state i {
  color: var(--app-accent);
  font-size: 1.75rem;
}

.empty-state h2 {
  color: var(--app-text);
  font-size: 1.1rem;
  margin: 0.55rem 0 0.35rem;
}

.source-url {
  display: block;
  word-break: break-word;
  margin-bottom: 0.8rem;
}

.sticky-sidebar {
  position: sticky;
  top: 1rem;
}

.facts-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
}

.facts-list div {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.75rem;
  border-bottom: 1px solid var(--app-border);
  padding-bottom: 0.6rem;
}

.facts-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.facts-list dt {
  color: var(--app-muted);
  font-weight: 600;
}

.facts-list dd {
  margin: 0;
  text-align: right;
}

.review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.review-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.35rem;
}

.context-card {
  display: grid;
  gap: 0.25rem;
}

.context-card strong {
  font-size: 1rem;
}

.compact-list {
  display: grid;
  gap: 0.5rem;
}

.compact-list a,
.empty-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  padding: 0.7rem;
  color: var(--app-text);
}

.compact-list a:hover {
  border-color: var(--app-border-strong);
  background: rgba(255, 255, 255, 0.055);
}

.empty-row {
  color: var(--app-muted);
}

.distribution-panel {
  display: grid;
  gap: 0.45rem;
}

.distribution-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--app-border);
  padding: 0.6rem 0;
}

.distribution-row:last-child {
  border-bottom: 0;
}

.profile-form {
  margin-bottom: 2rem;
}

.profile-summary {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.profile-summary strong {
  font-size: 1.05rem;
}

.hint-list {
  display: grid;
  gap: 0.65rem;
  color: var(--app-muted);
  font-size: 0.9rem;
}

.hint-list div {
  display: flex;
  gap: 0.45rem;
}

.hint-list i {
  color: var(--app-accent);
}

.form-section {
  margin-bottom: 1rem;
}

.form-section textarea {
  min-height: 9rem;
  resize: vertical;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background: rgba(17, 19, 20, 0.96);
  padding: 0.8rem;
}

.form-control,
.form-select,
textarea {
  border-color: var(--panel-border);
  background-color: rgba(255, 255, 255, 0.035);
}

.form-control:focus,
.form-select:focus,
textarea:focus {
  border-color: rgba(76, 201, 176, 0.65);
  box-shadow: 0 0 0 0.2rem rgba(76, 201, 176, 0.12);
}

.opportunity-title {
  max-width: 52rem;
}

.assessment-toast-container {
  z-index: 1080;
}

.assessment-toast {
  min-width: min(28rem, calc(100vw - 2rem));
}

.list-group-item {
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--app-border);
  color: var(--app-text);
}

.list-group-item-action:hover {
  background: rgba(255, 255, 255, 0.055);
  color: var(--app-text);
}

.pagination {
  --bs-pagination-bg: rgba(255, 255, 255, 0.035);
  --bs-pagination-border-color: var(--app-border);
  --bs-pagination-hover-bg: rgba(255, 255, 255, 0.07);
  --bs-pagination-hover-border-color: var(--app-border-strong);
}

@media (max-width: 1199.98px) {
  .filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-search,
  .filter-actions {
    grid-column: 1 / -1;
  }

  .sticky-sidebar {
    position: static;
  }
}

@media (max-width: 991.98px) {
  .app-nav-inner {
    padding-inline: 1rem;
  }

  .app-company-chip,
  .app-search,
  .app-admin-link {
    margin-top: 0.75rem;
  }

  .app-search {
    width: 100%;
  }

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

  .page-actions {
    justify-content: flex-start;
  }

  .score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .app-main {
    padding: 1rem;
  }

  .filter-panel {
    grid-template-columns: 1fr;
  }

  .filter-search,
  .filter-actions {
    grid-column: auto;
  }

  .filter-actions,
  .form-footer,
  .review-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .filter-actions .btn,
  .form-footer .btn {
    width: 100%;
  }

  .facts-list div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .facts-list dd {
    text-align: left;
  }
}
