:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-2: #f0f4f8;
  --text: #17202a;
  --muted: #657180;
  --line: #dbe2ea;
  --accent: #2563eb;
  --accent-2: #0f766e;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok: #15803d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.cv-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.cv-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.cv-kicker {
  display: block;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 6px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: 30px; letter-spacing: 0; }
h2 { font-size: 17px; letter-spacing: 0; }
h3 { font-size: 15px; letter-spacing: 0; }
p { color: var(--muted); line-height: 1.5; }

.cv-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cv-btn {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.cv-btn:hover { border-color: var(--accent); color: var(--accent); }
.cv-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.cv-btn-primary:hover { color: #fff; filter: brightness(0.96); }
.cv-btn-ghost { background: var(--panel-2); }

.cv-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  background: var(--panel-2);
}

.cv-status.complete { color: var(--ok); background: #ecfdf3; border-color: #bbf7d0; }
.cv-status.partial { color: var(--warn); background: #fff7ed; border-color: #fed7aa; }
.cv-status.insufficient { color: var(--danger); background: #fef2f2; border-color: #fecaca; }

.cv-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 330px;
  min-height: 0;
}

.cv-sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cv-tab {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

.cv-tab:hover, .cv-tab.active {
  color: var(--accent);
  background: #eff6ff;
  border-color: #bfdbfe;
}

.cv-main {
  min-width: 0;
  padding: 18px;
  overflow: auto;
}

.cv-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(150px, 210px) minmax(220px, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

select, input {
  width: 100%;
  margin-top: 5px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: var(--panel);
  color: var(--text);
}

.cv-readiness {
  margin-bottom: 14px;
}

.cv-alert {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 13px 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.cv-alert.partial { border-color: #fed7aa; background: #fff7ed; }
.cv-alert.insufficient { border-color: #fecaca; background: #fef2f2; }
.cv-alert.complete { border-color: #bbf7d0; background: #ecfdf3; }

.cv-source-pills, .cv-chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cv-pill {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cv-pill.ok { color: var(--ok); border-color: #bbf7d0; }
.cv-pill.missing { color: var(--warn); border-color: #fed7aa; }

.cv-view {
  min-height: 520px;
}

.cv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.cv-card, .cv-panel, .cv-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.cv-card {
  padding: 14px;
}

.cv-card strong {
  display: block;
  font-size: 26px;
  margin-top: 6px;
}

.cv-list {
  display: grid;
  gap: 9px;
}

.cv-row {
  padding: 12px;
  cursor: pointer;
}

.cv-row:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.cv-row-meta {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 7px;
}

.cv-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.cv-matrix-cell {
  padding: 12px;
}

.cv-network {
  min-height: 540px;
  position: relative;
  overflow: hidden;
}

.cv-network svg {
  width: 100%;
  min-height: 540px;
  display: block;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.cv-node-label {
  font-size: 11px;
  fill: #253142;
  pointer-events: none;
}

.cv-venn-stage {
  min-height: 520px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.cv-venn-circle {
  position: absolute;
  border: 2px solid;
  border-radius: 50%;
  opacity: 0.72;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 36px;
  text-align: center;
  font-weight: 800;
}

.cv-venn-intersection {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, 82%);
  max-height: 72%;
  overflow: auto;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.cv-detail {
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 16px;
  overflow: auto;
}

.cv-evidence {
  border-left: 3px solid #93c5fd;
  padding: 8px 10px;
  margin: 8px 0;
  background: #f8fbff;
  color: #253142;
  line-height: 1.5;
}

.cv-empty {
  padding: 18px;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (max-width: 980px) {
  .cv-header { flex-direction: column; }
  .cv-layout { grid-template-columns: 1fr; }
  .cv-sidebar {
    position: sticky;
    top: 0;
    z-index: 4;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .cv-tab { white-space: nowrap; }
  .cv-detail { border-left: 0; border-top: 1px solid var(--line); }
  .cv-toolbar { grid-template-columns: 1fr; }
}
