:root {
  --bg: #f6f7f4;
  --ink: #1e2320;
  --muted: #657068;
  --line: #d8ded6;
  --panel: #ffffff;
  --accent: #0f7b6c;
  --accent-2: #b7433e;
  --accent-3: #315f9f;
  --warn: #b67612;
  --good: #0e7a3e;
  --shadow: 0 18px 44px rgba(35, 48, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 123, 108, 0.09), transparent 36%),
    linear-gradient(315deg, rgba(183, 67, 62, 0.08), transparent 32%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.95);
}

button.secondary,
button.chip {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}

a {
  color: inherit;
  text-decoration-color: rgba(15, 123, 108, 0.4);
  text-underline-offset: 3px;
}

button.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 320px) 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  padding: 24px 22px;
  overflow: auto;
}

.brand-block {
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 2.2rem;
  line-height: 1.04;
}

.subhead {
  color: var(--muted);
  line-height: 1.5;
}

.panel {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.panel h2 {
  font-size: 1rem;
  margin-bottom: 14px;
}

.custom-scan summary {
  cursor: pointer;
  font-weight: 800;
}

.scan-meta,
.helper-text,
.view-meta {
  color: var(--muted);
  line-height: 1.45;
}

.scan-meta {
  margin-bottom: 8px;
  font-weight: 700;
}

.helper-text,
.view-meta {
  margin-bottom: 0;
  font-size: 0.88rem;
}

label {
  display: block;
  margin: 14px 0 7px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 123, 108, 0.13);
}

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

.toggle-group {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.toggle-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.button-row,
.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.score-grid div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 12px;
}

.score-grid strong,
.score-grid span {
  display: block;
}

.score-grid strong {
  font-size: 1.35rem;
}

.score-grid span {
  color: var(--muted);
  font-size: 0.78rem;
}

.workspace {
  min-width: 0;
  padding: 20px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 18px;
}

.hero-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 132px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.74)),
    repeating-linear-gradient(135deg, rgba(15, 123, 108, 0.11) 0 12px, rgba(49, 95, 159, 0.11) 12px 24px, rgba(183, 67, 62, 0.1) 24px 36px);
  box-shadow: var(--shadow);
  padding: 22px;
}

.hero-strip h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
}

.signal-bar {
  display: grid;
  grid-template-columns: repeat(5, 10px);
  align-items: end;
  gap: 5px;
  height: 78px;
}

.signal-bar span {
  width: 10px;
  border-radius: 5px;
  background: var(--accent);
}

.signal-bar span:nth-child(1) { height: 30%; background: var(--accent-3); }
.signal-bar span:nth-child(2) { height: 58%; }
.signal-bar span:nth-child(3) { height: 42%; background: var(--accent-2); }
.signal-bar span:nth-child(4) { height: 82%; }
.signal-bar span:nth-child(5) { height: 66%; background: var(--warn); }

.results {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  overflow-x: auto;
}

.table-header,
.result-row {
  display: grid;
  grid-template-columns:
    minmax(190px, 1.08fr)
    minmax(130px, 0.78fr)
    110px
    96px
    minmax(150px, 0.9fr)
    minmax(170px, 1fr)
    minmax(230px, 1.25fr);
  min-width: 1130px;
  gap: 12px;
  align-items: start;
}

.table-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf2ee;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  padding: 12px 16px;
}

.result-row {
  min-height: 104px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.result-row:hover {
  background: #fbfcfb;
}

.result-section + .result-section {
  border-top: 10px solid var(--bg);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #f7faf7;
  border-top: 1px solid var(--line);
  padding: 14px 16px;
}

.section-primary .section-heading {
  background: #173c35;
  color: white;
  border-top: 0;
  padding: 18px 16px;
}

.section-foundation .section-heading {
  background:
    linear-gradient(90deg, rgba(190, 38, 38, 0.22), rgba(255, 245, 245, 0.96)),
    #fff1f1;
  border-left: 8px solid #b91c1c;
  border-top: 2px solid rgba(185, 28, 28, 0.42);
  padding: 18px 16px;
}

.section-state .section-heading {
  background:
    linear-gradient(90deg, rgba(22, 163, 74, 0.24), rgba(240, 253, 244, 0.96)),
    #f0fdf4;
  border-left: 8px solid #15803d;
  border-top: 2px solid rgba(21, 128, 61, 0.42);
  padding: 18px 16px;
}

.section-other .section-heading {
  background:
    linear-gradient(90deg, rgba(234, 179, 8, 0.28), rgba(254, 252, 232, 0.96)),
    #fefce8;
  border-left: 8px solid #ca8a04;
  border-top: 2px solid rgba(202, 138, 4, 0.42);
  padding: 18px 16px;
}

.section-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.section-foundation .section-heading h3 {
  color: #991b1b;
  font-size: 1.08rem;
}

.section-foundation .section-kicker {
  color: #b91c1c;
}

.section-foundation .section-heading span {
  color: #991b1b;
  font-weight: 800;
}

.section-state .section-heading h3 {
  color: #166534;
  font-size: 1.08rem;
}

.section-state .section-kicker {
  color: #15803d;
}

.section-state .section-heading span {
  color: #166534;
  font-weight: 800;
}

.section-other .section-heading h3 {
  color: #854d0e;
  font-size: 1.08rem;
}

.section-other .section-kicker {
  color: #a16207;
}

.section-other .section-heading span {
  color: #854d0e;
  font-weight: 800;
}

.section-heading span,
.section-empty {
  color: var(--muted);
  font-size: 0.84rem;
}

.section-primary .section-heading span,
.section-primary .section-kicker {
  color: rgba(255, 255, 255, 0.78);
}

.section-kicker {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-empty {
  border-top: 1px solid var(--line);
  padding: 16px;
}

.opportunity-title {
  margin: 0 0 6px;
  font-weight: 800;
}

.meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.table-cell {
  min-width: 0;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: break-word;
}

.source-cell,
.description-cell {
  color: var(--muted);
  font-weight: 600;
}

.deadline {
  font-weight: 800;
}

.deadline.urgent {
  color: var(--warn);
}

.deadline.past {
  color: var(--accent-2);
}

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

.reason {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 0.78rem;
}

.empty-state {
  padding: 48px 28px;
  max-width: 640px;
}

.empty-state h2 {
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .toolbar,
  .table-header,
  .result-row {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .table-header {
    display: none;
  }

  .result-row {
    gap: 10px;
  }

  .table-cell::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  .opportunity-cell::before {
    display: none;
  }
}

/* Sort button styling */
.sort-btn {
  min-height: auto;
  padding: 2px 6px;
  margin-left: 6px;
  font-size: 0.85em;
  border: 1px solid var(--muted);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.sort-btn:hover {
  background: var(--line);
  color: var(--ink);
  border-color: var(--ink);
}

/* Tab switcher styling */
.tab-switcher {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--line);
  margin-right: auto;
}

.tab-button {
  min-height: 40px;
  padding: 10px 16px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.tab-button:hover {
  background: transparent;
  color: var(--ink);
}

.tab-button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}
