:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #f0f4f8;
  --line: #d7dee8;
  --text: #15202e;
  --muted: #65758b;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #a16207;
  --shadow: 0 14px 40px rgba(21, 32, 46, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  background: #0b1220;
  color: white;
}

.topbar h1,
.analysis-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.6rem, 2vw, 2.3rem);
}

.eyebrow {
  margin: 0 0 6px;
  color: #8fb8ff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill {
  min-width: 138px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #dbeafe;
  font-size: 0.85rem;
  text-align: center;
  white-space: nowrap;
}

main {
  padding: 24px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  max-width: 1420px;
  margin: 0 auto 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  background: white;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 20px;
  max-width: 1420px;
  margin: 0 auto;
}

.opportunity-list,
.analysis {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.opportunity-list {
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

#opportunities {
  display: grid;
}

.opp {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: white;
  color: var(--text);
  text-align: left;
}

.opp:hover,
.opp.active {
  background: #eef8f6;
}

.opp strong {
  font-size: 0.95rem;
  line-height: 1.35;
}

.opp-meta,
.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.analysis {
  padding: 20px;
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.analysis-header .eyebrow {
  color: var(--accent);
}

.analysis-header h2 {
  font-size: clamp(1.3rem, 1.6vw, 1.8rem);
}

.pwin {
  display: grid;
  place-items: center;
  min-width: 96px;
  height: 70px;
  border-radius: 8px;
  background: #e6f4f1;
  color: var(--accent-strong);
  font-size: 1.7rem;
  font-weight: 900;
}

.metric-grid,
.dashboard-grid {
  display: grid;
  gap: 14px;
}

.metric-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 18px;
}

.metric-grid > div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.metric-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-grid strong {
  font-size: 1.1rem;
}

.dashboard-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  letter-spacing: 0;
}

.stack {
  display: grid;
  gap: 10px;
}

.row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.row-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.row-title strong {
  line-height: 1.3;
}

.score {
  color: var(--accent-strong);
  font-weight: 900;
  white-space: nowrap;
}

.rate-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: white;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.86rem;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.empty {
  padding: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 960px) {
  .filters,
  .layout,
  .dashboard-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .analysis-header {
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    padding: 14px;
  }

  .status-pill,
  .pwin {
    align-self: stretch;
  }
}
