:root {
  --bg: #eef2f7;
  --panel: #ffffff;
  --panel-alt: #f8fbff;
  --border: #d7e0ea;
  --text: #13233b;
  --muted: #607086;
  --primary: #0f5ea8;
  --primary-dark: #0c4c87;
  --accent: #d98b2b;
  --success: #1d8c62;
  --warning: #b77517;
  --danger: #b94141;
  --shadow: 0 12px 28px rgba(13, 33, 59, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(15, 94, 168, 0.08), transparent 24%),
    linear-gradient(180deg, #f7fafd 0%, var(--bg) 100%);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 2.5rem 0.7rem;
  border-bottom: 1px solid rgba(15, 94, 168, 0.08);
  background: rgba(247, 250, 253, 0.84);
  backdrop-filter: blur(14px);
}

.topbar-brand {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.65rem);
}

.detail-header h2,
.page-intro h2 {
  margin: 0.25rem 0 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
}

.topbar-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.workspace-nav {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.workspace-link,
.panel-kicker,
.score-pill,
.button,
.eyebrow {
  letter-spacing: 0.03em;
}

.workspace-link,
.panel-kicker {
  padding: 0.38rem 0.62rem;
  border-radius: 999px;
  background: rgba(15, 94, 168, 0.08);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.workspace-link.is-active {
  background: rgba(15, 94, 168, 0.16);
  color: var(--primary-dark);
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.page-shell {
  padding: 1rem 2.5rem 2rem;
}

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

.summary-strip {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.panel,
.stat-card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-alt) 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 1.1rem;
}

.panel-slim {
  padding: 1rem;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 1.02rem;
}

.hero-grid,
.content-grid,
.detail-columns,
.button-row,
.stats-grid,
.filters-grid {
  display: grid;
  gap: 1rem;
}

.hero-grid,
.content-grid {
  grid-template-columns: 1.5fr 1fr;
  margin-bottom: 1rem;
}

.assumptions-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.8fr);
}

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

.enrichment-grid {
  grid-template-columns: minmax(220px, 0.9fr) repeat(2, minmax(0, 1fr));
}

.content-grid {
  align-items: start;
}

.detail-grid {
  grid-template-columns: 1.3fr 0.7fr;
}

.stack-form,
.sidebar-stack {
  display: grid;
  gap: 1rem;
}

.dropzone {
  display: grid;
  gap: 0.55rem;
  padding: 1.1rem;
  border: 1.5px dashed rgba(15, 94, 168, 0.4);
  border-radius: 16px;
  background: rgba(15, 94, 168, 0.04);
  transition: 0.2s ease;
  cursor: pointer;
}

.dropzone-compact {
  gap: 0.4rem;
  padding: 0.95rem;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--primary);
  background: rgba(15, 94, 168, 0.08);
}

.dropzone input {
  display: none;
}

.dropzone strong {
  font-size: 0.96rem;
}

.dropzone span,
.dropzone em,
.muted,
.meta-line {
  color: var(--muted);
  font-size: 0.92rem;
}

.button-row {
  grid-template-columns: repeat(2, minmax(0, auto));
  justify-content: start;
}

.panel-actions,
.compact-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.panel-actions {
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.62rem 0.95rem;
  border: 1px solid rgba(15, 94, 168, 0.15);
  border-radius: 12px;
  background: #edf5ff;
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.button-compact {
  min-height: 34px;
  padding: 0.42rem 0.72rem;
  font-size: 0.74rem;
}

.is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.button:hover {
  border-color: rgba(15, 94, 168, 0.35);
}

.button-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
}

.button-link {
  background: transparent;
}

.filters-panel {
  margin-bottom: 1rem;
}

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

.filters-grid label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.filters-grid input,
.filters-grid select {
  min-height: 42px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

.filter-actions {
  display: flex;
  align-items: end;
  gap: 0.75rem;
}

.compact-filter-grid {
  gap: 0.75rem;
}

.compact-search-form {
  gap: 0.7rem;
}

.quick-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(4, minmax(140px, 1fr)) auto;
  gap: 0.65rem;
  align-items: end;
}

.quick-filter-actions {
  justify-content: flex-end;
}

.advanced-filters {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(15, 94, 168, 0.03);
}

.advanced-filters summary {
  cursor: pointer;
  padding: 0.7rem 0.9rem;
  color: var(--primary-dark);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.advanced-filters[open] summary {
  border-bottom: 1px solid var(--border);
}

.advanced-filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 0.8rem 0.9rem 0.9rem;
}

.advanced-filter-grid label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.advanced-filter-grid input,
.advanced-filter-grid select {
  min-height: 36px;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

.filters-panel .filters-grid label,
.assumptions-form label {
  font-size: 0.82rem;
}

.filters-panel .filters-grid input,
.filters-panel .filters-grid select,
.assumptions-form select {
  min-height: 38px;
  padding: 0.55rem 0.65rem;
}

.assumptions-form {
  display: flex;
  align-items: end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.assumptions-form label {
  display: grid;
  gap: 0.4rem;
  flex: 1 1 24rem;
  color: var(--muted);
}

.stats-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 0.85rem;
}

.dashboard-stats .stat-card {
  padding: 0.75rem 0.85rem;
}

.dashboard-stats .stat-card strong {
  font-size: 1.02rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1rem;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.stat-card strong {
  display: block;
  margin-top: 0.1rem;
  font-size: 1.4rem;
}

.table-wrap {
  overflow-x: auto;
}

.opportunity-table {
  width: 100%;
  border-collapse: collapse;
}

.dashboard-table {
  min-width: 0;
  table-layout: fixed;
}

.dashboard-col-score {
  width: 6.5%;
}

.dashboard-col-recommendation {
  width: 12%;
}

.dashboard-col-solicitation {
  width: 14%;
}

.dashboard-col-nsn {
  width: 13%;
}

.dashboard-col-part {
  width: 13%;
}

.dashboard-col-qty {
  width: 7%;
}

.dashboard-col-sources {
  width: 8%;
}

.dashboard-col-match {
  width: 11%;
}

.dashboard-col-date {
  width: 9%;
}

.dashboard-col-action {
  width: 6.5%;
}

.opportunity-table th,
.opportunity-table td {
  padding: 0.8rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

.opportunity-table th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.dashboard-table th,
.dashboard-table td {
  padding: 0.5rem 0.28rem;
  font-size: 0.8rem;
}

.dashboard-table th {
  font-size: 0.69rem;
}

.dashboard-table tbody tr:hover {
  background: rgba(15, 94, 168, 0.04);
}

.table-sort-link {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  color: inherit;
}

.table-sort-link.is-active {
  color: var(--primary-dark);
}

.sort-indicator {
  min-width: 0.9rem;
  color: var(--primary);
  font-size: 0.72rem;
}

.table-primary {
  font-weight: 700;
  color: var(--text);
}

.table-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-secondary {
  margin-top: 0.14rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.table-code {
  font-family: Consolas, "SFMono-Regular", monospace;
  letter-spacing: 0.01em;
}

.table-nowrap {
  white-space: nowrap;
}

.table-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(15, 94, 168, 0.09);
  color: var(--primary-dark);
  font-size: 0.67rem;
  font-weight: 700;
  white-space: nowrap;
}

.table-chip-muted {
  background: rgba(96, 112, 134, 0.12);
  color: var(--muted);
}

.table-chip-success {
  background: rgba(29, 140, 98, 0.14);
  color: var(--success);
}

.table-chip-warning {
  background: rgba(217, 139, 43, 0.14);
  color: var(--warning);
}

.table-cell-score,
.table-cell-sources,
.table-cell-date,
.table-cell-action {
  white-space: nowrap;
}

.table-link {
  color: var(--primary);
  font-weight: 700;
}

.table-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0.18rem 0.42rem;
  border: 1px solid rgba(15, 94, 168, 0.16);
  border-radius: 10px;
  background: rgba(15, 94, 168, 0.05);
}

.table-link-button:hover {
  border-color: rgba(15, 94, 168, 0.3);
  background: rgba(15, 94, 168, 0.08);
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.table-page-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 94, 168, 0.08);
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

.score-quote-immediately {
  background: rgba(29, 140, 98, 0.14);
  color: var(--success);
}

.score-review-soon {
  background: rgba(217, 139, 43, 0.14);
  color: var(--warning);
}

.score-low-priority,
.score-ignore {
  background: rgba(96, 112, 134, 0.14);
  color: var(--muted);
}

.flash-stack {
  display: grid;
  gap: 0.75rem;
  padding: 0 2.5rem 1rem;
}

.flash {
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid transparent;
}

.flash-success {
  background: rgba(29, 140, 98, 0.12);
  border-color: rgba(29, 140, 98, 0.2);
}

.flash-warning {
  background: rgba(217, 139, 43, 0.12);
  border-color: rgba(217, 139, 43, 0.2);
}

.flash-error {
  background: rgba(185, 65, 65, 0.12);
  border-color: rgba(185, 65, 65, 0.2);
}

.notes-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.65rem;
}

.notes-list.compact {
  gap: 0.4rem;
}

.empty-state {
  padding: 2rem 0.5rem 1rem;
  text-align: center;
}

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

.detail-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.analysis-block {
  margin: 0 0 1.2rem;
  line-height: 1.65;
}

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

.detail-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.45rem 0.8rem;
  margin: 0;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 700;
}

.detail-list dd {
  margin: 0;
}

.description-details {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(15, 94, 168, 0.03);
}

.description-details summary {
  cursor: pointer;
  padding: 0.9rem 1rem;
  color: var(--primary-dark);
  font-weight: 700;
}

.description-details[open] summary {
  border-bottom: 1px solid var(--border);
}

.description-body {
  max-height: 16rem;
  overflow: auto;
  padding: 1rem;
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--text);
}

@media (max-width: 1200px) {
  .filters-grid,
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quick-filter-grid,
  .advanced-filter-grid,
  .imports-grid,
  .enrichment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .page-shell,
  .topbar,
  .flash-stack {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hero-grid,
  .content-grid,
  .detail-grid,
  .detail-columns,
  .detail-stats,
  .stats-grid,
  .filters-grid,
  .quick-filter-grid,
  .advanced-filter-grid,
  .imports-grid,
  .enrichment-grid,
  .assumptions-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .detail-header,
  .page-intro,
  .table-footer {
    align-items: start;
    flex-direction: column;
  }

  .topbar {
    display: flex;
  }

  .topbar-brand {
    flex-direction: column;
    align-items: start;
    gap: 0.15rem;
  }

  .topbar-subtitle {
    text-align: left;
  }
}
