:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --text: #17191d;
  --muted: #667085;
  --border: #d9dee7;
  --accent: #0f6b5f;
  --accent-2: #8a5a12;
  --danger: #a33b2a;
  --focus: #2b66d9;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111419;
    --surface: #191e25;
    --surface-2: #222a33;
    --text: #edf1f6;
    --muted: #a7b0bd;
    --border: #343d49;
    --accent: #4fb7a8;
    --accent-2: #d7a852;
    --danger: #e08070;
    --focus: #79a7ff;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.header-actions {
  display: flex;
  gap: .75rem;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
}

.refresh-button {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: .45rem .75rem;
  white-space: nowrap;
  cursor: pointer;
}

.refresh-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.refresh-button:disabled {
  cursor: wait;
  opacity: .65;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: end;
  padding: 2rem max(1rem, 5vw) 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.eyebrow,
.refresh,
.section-heading p,
label span {
  color: var(--muted);
  margin: 0;
}

h1 {
  margin: .15rem 0 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.05;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 1.25rem max(1rem, 5vw) 3rem;
}

.metrics {
  display: grid;
  /* auto-fit instead of a fixed column count -- MON-511 added a 6th metric
     card (content_calendar) without needing another CSS change per future
     metric. */
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}

.metric {
  min-height: 94px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: .85rem;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.metric:hover {
  border-color: var(--accent);
}

.metric strong {
  display: block;
  font-size: 1.9rem;
  line-height: 1.15;
}

.metric span {
  color: var(--muted);
}

.controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(140px, 180px) minmax(160px, 220px);
  gap: .75rem;
  align-items: end;
  margin: 1rem 0;
}

label span {
  display: block;
  margin-bottom: .3rem;
  font-size: .86rem;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: .55rem .65rem;
}

.tabs {
  display: flex;
  gap: .4rem;
  overflow-x: auto;
  padding-bottom: .3rem;
  margin-bottom: .75rem;
}

.tab {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: .45rem .75rem;
  white-space: nowrap;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.blockers {
  border-left: 4px solid var(--danger);
  background: var(--surface);
  padding: .8rem 1rem;
  margin: .75rem 0;
}

.table-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.section-heading h2 {
  margin: 0;
  font-size: 1.15rem;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

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

th {
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 1;
}

th button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  padding: 0;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.details-row td {
  background: var(--surface-2);
  color: var(--muted);
  cursor: default;
}

.details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .65rem 1rem;
}

.details b {
  display: block;
  color: var(--text);
  font-size: .82rem;
}

.evidence-drawer td {
  box-shadow: inset 4px 0 0 var(--accent-2);
}

.evidence-state {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .12rem .42rem;
  color: var(--muted);
  background: var(--surface);
}

.evidence-missing,
.evidence-partial,
.evidence-stale {
  color: var(--accent-2);
  border-color: var(--accent-2);
}

.evidence-missing {
  color: var(--danger);
  border-color: var(--danger);
}

body[data-active-section="opportunity_queue"] .table-shell {
  border-top: 3px solid var(--accent);
}

.structured-evidence {
  max-width: 100%;
  margin: .35rem 0 0;
  padding: .65rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  body[data-active-section="opportunity_queue"] table {
    min-width: 760px;
  }

  body[data-active-section="opportunity_queue"] .details {
    grid-template-columns: minmax(0, 1fr);
  }
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.pill {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .12rem .5rem;
  color: var(--muted);
  background: var(--surface);
  white-space: nowrap;
}

.priority-1 {
  color: var(--danger);
}

.priority-2,
.priority-3 {
  color: var(--accent-2);
}

@media (max-width: 860px) {
  .topbar {
    display: block;
  }

  .header-actions {
    justify-content: flex-start;
    text-align: left;
    margin-top: .8rem;
  }

  .refresh {
    margin-top: 0;
  }

  .controls {
    grid-template-columns: 1fr;
  }

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

  .metric {
    min-height: 78px;
  }
}
