/* The workspace: dropzone, graph canvas, topic list, page brief, content plan. */

/* ------------------------------------------------------------- dropzone */
#dropzone {
  position: relative; overflow: hidden;
  border: 1px dashed rgba(255, 255, 255, .16); border-radius: 18px;
  padding: 3.2rem 1.5rem; text-align: center; cursor: pointer;
  background:
    radial-gradient(600px 200px at 50% 0%, rgba(94, 106, 210, .10), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .01));
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
#dropzone:hover, #dropzone.drag { border-color: rgba(94, 106, 210, .6); transform: translateY(-1px); }
#dropzone .dzicon {
  width: 44px; height: 44px; margin: 0 auto .9rem; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
}
#dropzone .dztitle { font-size: 1.02rem; font-weight: 600; letter-spacing: -.015em; }
#dropzone .dztitle strong { color: var(--accent-hi); }
#dropzone .hint { color: var(--dim); font-size: .84rem; margin-top: .5rem; }

/* -------------------------------------------------------------- progress */
#progress { display: none; margin: 1.8rem 0; }
#progress .bar { height: 6px; background: rgba(255, 255, 255, .06); border-radius: 99px; overflow: hidden; }
#progress .fill {
  height: 100%; width: 100%; border-radius: 99px;
  background: var(--accent);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .25s var(--ease);
}
#progress .label { color: var(--muted); font-size: .86rem; margin-top: .55rem; }

/* --------------------------------------------------------------- results */
#results { display: none; }
.toolbar { display: flex; gap: .4rem; margin: 0 0 .9rem; flex-wrap: wrap; align-items: center; }
.toolbar button {
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.015));
  color: var(--text); border: 1px solid var(--line); border-radius: 9px;
  padding: .4rem .7rem; cursor: pointer; font: 500 .82rem/1 var(--sans);
  transition: border-color .16s ease, transform .16s ease;
}
.toolbar button:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.toolbar button:disabled { opacity: .38; cursor: default; }
.toolbar button:disabled:hover { border-color: var(--line); transform: none; }
.toolbar button.key {
  background: var(--accent); border-color: transparent; color: var(--on-accent);
  box-shadow: none;
}
.toolbar .tag { color: var(--muted); font-size: .84rem; margin-left: .3rem; }

#capBanner {
  display: none; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: linear-gradient(180deg, rgba(94, 106, 210,.14), rgba(94, 106, 210,.05));
  border: 1px solid rgba(94, 106, 210, .34);
  border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1rem; font-size: .88rem;
}
#capBanner button { margin-left: auto; }

.caption { color: var(--muted); font-size: .85rem; margin: .5rem 0 .8rem; max-width: 88ch; }
.caption b { color: var(--text); font-weight: 600; }

/* -------------------------------------------------------------- controls */
.controls {
  display: flex; gap: .35rem; flex-wrap: wrap; align-items: center;
  margin: 0 0 .9rem; padding: .5rem .6rem;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.012));
  border: 1px solid var(--line); border-radius: 12px;
  font-size: .82rem; color: var(--muted);
}
.controls label { display: inline-flex; align-items: center; gap: .45rem; padding: .2rem .5rem; border-radius: 8px; }
.controls select {
  background: var(--surface-3); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: .3rem 1.6rem .3rem .5rem; font: 500 .82rem/1 var(--sans);
  appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.controls select:hover { border-color: var(--line-strong); }
.controls select:disabled { opacity: .4; cursor: default; }
.controls input[type=range] { width: 92px; accent-color: var(--accent); cursor: pointer; }
.controls .chk { gap: .4rem; cursor: pointer; }
.controls .chk input { accent-color: var(--accent); cursor: pointer; }
.controls .sep { width: 1px; height: 20px; background: var(--line); margin: 0 .2rem; }

/* ------------------------------------------------------------- workspace */
.workspace { display: grid; grid-template-columns: 268px 1fr; gap: .75rem; }
.side {
  display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.012));
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: .7rem;
}
.side input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 9px;
  padding: .5rem .65rem; color: var(--text); font: 400 .86rem/1.2 var(--sans);
}
.side input:focus { outline: none; border-color: rgba(94, 106, 210,.55); box-shadow: 0 0 0 3px rgba(94, 106, 210,.12); }
.listmeta { color: var(--dim); font: 500 .7rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; margin: .7rem .25rem .4rem; }
#topicList { list-style: none; margin: 0; padding: 0; overflow-y: auto; max-height: 60vh; }
#topicList::-webkit-scrollbar { width: 8px; }
#topicList::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 8px; }
#topicList li {
  display: flex; align-items: center; gap: .55rem; padding: .4rem .45rem;
  border-radius: 8px; cursor: pointer; font-size: .845rem;
  transition: background .14s ease;
}
#topicList li:hover { background: rgba(255,255,255,.05); }
#topicList li.on { background: rgba(94, 106, 210,.16); box-shadow: inset 2px 0 0 var(--accent); }
#topicList li i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
#topicList li .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#topicList li .ct { color: var(--dim); font: 500 .74rem/1 var(--mono); flex: none; }
#topicList li.empty { color: var(--dim); cursor: default; }

.canvas { position: relative; min-width: 0; overflow: hidden; border-radius: var(--r-lg); }
#cy, #cy3d {
  height: 72vh; min-height: 500px; width: 100%;
  border: 1px solid var(--line); border-radius: var(--r-lg);
}
/* The map is the protagonist; its ground stays flat so the nodes carry the colour. */
#cy { background: var(--surface-1); }
#cy3d { display: none; background: var(--bg); overflow: hidden; }

#legend { display: flex; gap: .45rem; flex-wrap: wrap; margin: .7rem 0 0; }
#legend .chip {
  display: inline-flex; align-items: center; gap: .45rem; font-size: .79rem; color: var(--muted);
  background: rgba(255,255,255,.035); border: 1px solid var(--line);
  border-radius: 99px; padding: .22rem .72rem;
}
#legend .chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
#legend .chip.muted { border-style: dashed; color: var(--dim); }

#tooltip {
  display: none; position: absolute; z-index: 70; max-width: 300px;
  background: rgba(20, 25, 38, .97); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: .55rem .75rem; font-size: .82rem; pointer-events: none;
  box-shadow: var(--shadow-2);
}
#tooltip span { color: var(--muted); }

/* ----------------------------------------------------------- page brief */
#detail {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: 330px; max-width: calc(100% - 24px);
  background: rgba(14, 18, 28, .97); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 1.1rem 1.15rem; overflow-y: auto; backdrop-filter: blur(8px);
  transform: translateX(calc(100% + 24px)); transition: transform .3s cubic-bezier(.2,.7,.3,1);
  box-shadow: -18px 0 48px -12px rgba(1, 1, 2, .85);
}
#detail.open { transform: none; }
#detail .close {
  position: absolute; top: .45rem; right: .55rem; background: none; border: 0;
  color: var(--dim); font-size: 1.35rem; cursor: pointer; line-height: 1;
}
#detail .close:hover { color: var(--text); }
#detail h3 { font-size: 1.04rem; padding-right: 1.4rem; letter-spacing: -.015em; }
#detail .sub { color: var(--muted); font-size: .81rem; margin: .3rem 0 1rem; }
#detail h4 { font: 500 .7rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin: 1.2rem 0 .5rem; }
.metrics { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.metrics div b { display: block; font-size: 1.35rem; font-weight: 700; letter-spacing: -.03em; }
.metrics div span { color: var(--dim); font-size: .72rem; }
.mix { margin-top: 1rem; }
.mix .bar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: rgba(255,255,255,.06); }
.mix .seg { display: block; height: 100%; }
.ilabs { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .5rem; }
.ilab { display: inline-flex; align-items: center; gap: .32rem; font-size: .74rem; color: var(--muted); }
.ilab i { width: 7px; height: 7px; border-radius: 50%; }
.rel { display: flex; flex-wrap: wrap; gap: .35rem; }
.rel button {
  background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--muted);
  border-radius: 99px; padding: .2rem .65rem; font-size: .76rem; cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.rel button:hover { border-color: rgba(94, 106, 210,.5); color: var(--text); }
.kwlist { list-style: none; margin: 0; padding: 0; }
.kwlist li {
  display: flex; justify-content: space-between; gap: .7rem; font-size: .82rem;
  padding: .3rem 0; border-bottom: 1px solid rgba(255, 255, 255, .045);
}
.kwlist li b { color: var(--dim); font: 500 .76rem/1.4 var(--mono); }
#detail .copy {
  margin-top: 1rem; width: 100%; border: 0; border-radius: 9px; padding: .55rem;
  background: var(--accent); color: var(--on-accent);
  font: 600 .86rem/1 var(--sans); cursor: pointer;
  box-shadow: none;
}

/* ------------------------------------------------- editing a topic */
#detail .edit {
  margin: .9rem 0 .2rem; padding: .6rem .7rem; border-radius: 9px;
  background: rgba(255,255,255,.03); border: 1px solid var(--line);
}
#detail .edit summary {
  cursor: pointer; color: var(--dim); font: 500 .7rem/1 var(--mono);
  letter-spacing: .14em; text-transform: uppercase; list-style: none;
}
#detail .edit summary::-webkit-details-marker { display: none; }
#detail .edit summary::before { content: "+ "; }
#detail .edit[open] summary::before { content: "– "; }
#detail .edit summary:hover { color: var(--text); }
#detail .erow { display: flex; gap: .4rem; align-items: center; margin-top: .55rem; font-size: .8rem; color: var(--dim); }
#detail .erow input[type="text"], #detail .erow select {
  flex: 1; min-width: 0; background: rgba(255,255,255,.04); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px; padding: .34rem .5rem;
  font: 400 .82rem/1.3 var(--sans);
}
#detail .erow button {
  background: rgba(255,255,255,.05); color: var(--text); border: 1px solid var(--line-strong);
  border-radius: 7px; padding: .34rem .6rem; cursor: pointer;
  font: 500 .8rem/1 var(--sans); white-space: nowrap;
}
#detail .erow button:hover { border-color: var(--accent); }
#detail .erow button.danger { color: var(--sev-high); }
#detail .erow button.danger:hover { border-color: var(--sev-high); }
#detail .enote { color: var(--dim); font-size: .74rem; margin-top: .7rem; line-height: 1.45; }
#detail .emsg { color: var(--sev-medium); font-size: .78rem; margin-top: .4rem; min-height: 1em; }

/* ------------------------------------------------- restore a saved run */
#restoreBar {
  display: none; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; margin-bottom: .9rem; padding: .85rem 1.1rem; border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(94, 106, 210,.12), rgba(94, 106, 210,.04));
  border: 1px solid rgba(94, 106, 210,.3);
}
#restoreText { display: grid; gap: .15rem; }
#restoreText b { font-size: .92rem; }
#restoreText span { color: var(--muted); font-size: .82rem; }
#restoreBar .ractions { display: flex; gap: .5rem; }

/* ------------------------------------------------------------- views */
.viewtabs {
  display: flex; gap: .15rem; margin: 1.2rem 0 1.4rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.viewtabs .vt {
  position: relative; background: none; border: 0; cursor: pointer;
  color: var(--muted); font: 500 .88rem/1 var(--sans);
  padding: .6rem .9rem; border-radius: 8px 8px 0 0;
  display: inline-flex; align-items: center; gap: .45rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.viewtabs .vt:hover { color: var(--text); background: rgba(255,255,255,.035); }
.viewtabs .vt.on { color: var(--text); border-bottom-color: var(--accent); }
.viewtabs .vt.muted { color: var(--dim); }
.viewtabs .vt i {
  font-style: normal; font: 500 .7rem/1 var(--mono);
  background: rgba(94, 106, 210,.16); color: var(--accent-hi);
  border-radius: 99px; padding: .18rem .4rem;
}
.viewtabs .vt.on i { background: rgba(94, 106, 210,.28); }

.paneHead { max-width: 74ch; margin-bottom: 1.4rem; }
.paneHead h2 { font-size: 1.3rem; letter-spacing: -.02em; }
.paneHead p { color: var(--muted); font-size: .93rem; margin-top: .5rem; }
.paneHead .paneNote {
  color: var(--dim); font-size: .84rem; margin-top: .6rem;
  border-left: 2px solid var(--line-strong); padding-left: .7rem;
}

.empty {
  color: var(--muted); font-size: .93rem; line-height: 1.6; max-width: 62ch;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.012));
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.4rem 1.5rem;
}

/* shared table used by every data view */
.datatable td { vertical-align: top; }
.datatable .sub { color: var(--dim); font-size: .78rem; margin-top: .25rem; }
.datatable .more { color: var(--dim); font-size: .78rem; margin-top: .3rem; }
.urlcell a { color: var(--accent-hi); font: 400 .82rem/1.5 var(--mono); word-break: break-all; }
.urlcell a:hover { color: var(--accent-hi); }
.urlcell em { color: var(--dim); font-style: normal; font-size: .76rem; }
.chip {
  background: rgba(255,255,255,.05); border: 1px solid var(--line);
  color: var(--muted); border-radius: 99px; padding: .16rem .6rem; cursor: pointer;
  font: 500 .78rem/1.5 var(--sans); max-width: 22ch;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.pos:not(.dot), .warn:not(.dot), .match:not(.dot) {
  display: inline-block; min-width: 2.4rem; text-align: center;
  border-radius: var(--r-sm); padding: .2rem .45rem;
  font: 500 .82rem/1.3 var(--mono); font-variant-numeric: tabular-nums;
}
.pos:not(.dot)   { background: rgba(94, 106, 210,.16); color: var(--accent-hi); }
.warn:not(.dot)  { background: rgba(214, 160, 111,.16); color: var(--sev-medium); }
.match:not(.dot) { background: rgba(39, 166, 68,.15);  color: var(--pos); }

/* issues */
.sevhead {
  font: 500 .72rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  margin: 2rem 0 .9rem; display: flex; align-items: center; gap: .5rem;
}
.sevhead::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.sevhead.high { color: var(--sev-high); } .sevhead.high::before { background: var(--sev-high); }
.sevhead.medium { color: var(--sev-medium); } .sevhead.medium::before { background: var(--sev-medium); }
.sevhead.low { color: var(--dim); } .sevhead.low::before { background: var(--dim); }

.issuegrid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); }
.issue {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.1rem 1.2rem;
}
.issue.high { border-left-color: var(--sev-high); }
.issue.medium { border-left-color: var(--sev-medium); }
.issue header { display: flex; align-items: baseline; justify-content: space-between; gap: .7rem; }
.issue h4 { font-size: .98rem; letter-spacing: -.012em; }
.issue .count { color: var(--dim); font: 500 .76rem/1 var(--mono); white-space: nowrap; }
.issue p { color: var(--muted); font-size: .85rem; margin-top: .45rem; line-height: 1.55; }
.issue .more { color: var(--dim); font-size: .78rem; margin-top: .5rem; }
.pagelist { list-style: none; padding: 0; margin: .9rem 0 0; display: grid; gap: .4rem; }
.pagelist li {
  display: grid; gap: .1rem; padding-top: .4rem;
  border-top: 1px solid rgba(255,255,255,.045);
}
.pagelist li span { color: var(--dim); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------- content plan */
table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: .87rem; }
th, td { text-align: left; padding: .62rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--dim); font: 500 .72rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
td.kw { color: var(--muted); }
tbody tr { cursor: pointer; transition: background .14s ease; }
tbody tr:hover { background: rgba(94, 106, 210, .06); }
tbody tr.flash { background: rgba(94, 106, 210, .16); }
tbody tr.leftover td { opacity: .6; }
td .sub { color: var(--dim); font-weight: 400; font-size: .77rem; margin-top: .2rem; }
td .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: .35rem; }
.pill {
  display: inline-block; background: rgba(255,255,255,.045); border: 1px solid var(--line);
  border-radius: 99px; padding: .05rem .55rem; margin: .1rem; font-size: .79rem;
}

/* --------------------------------------------------------------- modal */
#modal {
  display: none; position: fixed; inset: 0; z-index: 90; padding: 1rem;
  background: rgba(5, 6, 10, .78); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
#modal .box {
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 16px;
  padding: 1.6rem; max-width: 430px; width: 100%; box-shadow: 0 24px 64px -20px rgba(1, 1, 2, .9);
}
#modal h3 { margin-bottom: .4rem; font-size: 1.1rem; }
#modal p { color: var(--muted); font-size: .88rem; margin-bottom: 1.1rem; }
#modal input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 9px;
  padding: .65rem .8rem; color: var(--text); font: 400 .9rem/1.2 var(--mono); margin-bottom: .9rem;
}
#modal input:focus { outline: none; border-color: rgba(94, 106, 210,.55); box-shadow: 0 0 0 3px rgba(94, 106, 210,.12); }
#modal .row { display: flex; gap: .6rem; }
#licenseMsg { font-size: .85rem; margin-top: .7rem; min-height: 1.2em; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  #topicList { max-height: 210px; }
  #detail { width: auto; left: 12px; }
  #cy, #cy3d { height: 62vh; }
}

/* ---------------------------------------------- compare, opportunity, terms */
.toolbar .vs {
  color: var(--accent-hi); background: rgba(94, 106, 210, .12);
  border: 1px solid rgba(94, 106, 210, .3); border-radius: 99px; padding: .12rem .6rem;
  font: 500 .78rem/1.5 var(--sans);
}
.opp {
  display: inline-block; vertical-align: middle;
  font: 600 .66rem/1.5 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--warn); background: rgba(250, 178, 25, .14); border: 1px solid rgba(250, 178, 25, .34);
  border-radius: 99px; padding: 0 .45rem; margin-left: .4rem;
}
.oppdot { color: var(--warn); font-style: normal; font-size: .78rem; }
.sortrow { margin-top: .6rem; font-size: .78rem; color: var(--dim); }
.sortrow label { display: flex; align-items: center; gap: .4rem; }
.sortrow select {
  flex: 1; background: var(--surface-3); color: var(--text); border: 1px solid var(--line);
  border-radius: 7px; padding: .25rem .4rem; font: 500 .78rem/1 var(--sans); cursor: pointer;
}
.kwlist .src {
  font: 600 .62rem/1.6 var(--mono); text-transform: uppercase; letter-spacing: .07em;
  border-radius: 99px; padding: 0 .35rem; margin-left: .4rem; font-style: normal;
}
.kwlist .src.mine { color: var(--pos); background: rgba(25, 158, 112, .16); }
.kwlist .src.theirs { color: var(--sev-medium); background: rgba(217, 89, 38, .16); }
.pill.gap { border-color: rgba(217, 89, 38, .45); color: var(--sev-medium); }

/* ------------------------------------------------------------- overview */
.statrow { display: flex; gap: 2.4rem; flex-wrap: wrap; margin-bottom: 1.8rem; }
.stat b { display: block; font-size: 2rem; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; }
.stat span { color: var(--dim); font-size: .8rem; }

.ovgrid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); margin-bottom: 1.1rem; }
.ovcard {
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.012));
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.2rem 1.3rem; margin-bottom: 1.1rem;
}
.ovcard h3 { font-size: 1rem; letter-spacing: -.015em; display: flex; align-items: center; gap: .6rem; }
.ovcard > .sub { color: var(--dim); font-size: .82rem; margin: .4rem 0 .9rem; line-height: 1.55; max-width: 62ch; }
.ovcard .datatable { margin-top: .4rem; }
.ovcard .empty { padding: .9rem 1rem; font-size: .88rem; }

.attention { list-style: none; padding: 0; margin: .8rem 0 0; display: grid; gap: .5rem; }
.attention li { display: flex; align-items: center; gap: .7rem; font-size: .88rem; color: var(--muted); }
.attention .n {
  min-width: 2.6rem; text-align: center; font: 600 .84rem/1.6 var(--mono);
  background: rgba(217,89,38,.16); color: var(--sev-medium); border-radius: 7px; padding: .1rem .4rem;
}
.attention li:last-child .n { background: rgba(94, 106, 210,.16); color: var(--accent-hi); }
.attention button { margin-left: auto; flex: none; max-width: none; overflow: visible; }

.qual { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .5rem; font-size: .88rem; color: var(--muted); }
.qual li { display: flex; align-items: center; gap: .55rem; }
.qual b { color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--accent2); } .dot.warn { background: var(--sev-medium); } .dot.bad { background: var(--sev-high); }

.score {
  display: inline-block; min-width: 2.4rem; text-align: center; border-radius: 7px;
  padding: .25rem .4rem; font: 700 .9rem/1.2 var(--mono);
  background: rgba(39, 166, 68,.15); color: var(--pos);
}
.dsgrid { display: grid; gap: .9rem 1.6rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: .9rem; }
.dsgrid b { display: block; font: 600 1.05rem/1.3 var(--mono); }
.dsgrid span { color: var(--dim); font-size: .78rem; }

/* ------------------------------------------------- why this cluster */
#detail .why {
  margin: .9rem 0 .2rem; padding: .6rem .7rem; border-radius: 9px;
  background: rgba(94, 106, 210,.07); border: 1px solid rgba(94, 106, 210,.22);
}
#detail .why summary {
  cursor: pointer; color: var(--accent-hi); font: 500 .7rem/1 var(--mono);
  letter-spacing: .12em; text-transform: uppercase; list-style: none;
}
#detail .why summary::-webkit-details-marker { display: none; }
#detail .why summary::before { content: "+ "; }
#detail .why[open] summary::before { content: "– "; }
.qrow { display: flex; align-items: center; gap: .6rem; margin-top: .55rem; font-size: .78rem; color: var(--muted); }
.qrow span { flex: 1; min-width: 0; }
.qrow i { width: 76px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.09); flex: none; }
.qrow i b { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.qrow em { font: 500 .74rem/1 var(--mono); font-style: normal; color: var(--dim); width: 2.4rem; text-align: right; }
.verdict { margin-top: .8rem; font-size: .82rem; color: var(--muted); }
.verdict.one { color: var(--accent2); }
.verdict.review { color: var(--sev-medium); }
.verdict.split { color: var(--sev-high); }
.because { margin: .5rem 0 0 1rem; padding: 0; color: var(--muted); font-size: .8rem; display: grid; gap: .2rem; }
.verd.one { color: var(--accent2); }
.verd.review { color: var(--sev-medium); }
.verd.split { color: var(--sev-high); }
.act {
  display: inline-block; margin-left: .3rem; border-radius: 5px; padding: .04rem .32rem;
  font: 500 .7rem/1.5 var(--sans);
}
.act.keep { background: rgba(39, 166, 68,.16); color: var(--pos); }
.act.merge { background: rgba(230,160,103,.16); color: var(--sev-medium); }
.act.drop { background: rgba(232,139,139,.16); color: var(--sev-high); }

/* scrollIntoView lands on #tool, and the header is sticky, so without this the
   first row of the toolbar sits underneath it */
#tool { scroll-margin-top: 76px; }

/* --------------------------------------------------------- app shell */
/* The sidebar took its width out of the map, which is the thing people came to
   look at. On a wide screen the workspace breaks out of the marketing column and
   takes the room back. */
.appshell { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.appmain { min-width: 0; }

.sidenav {
  position: sticky; top: 74px; display: flex; flex-direction: column; gap: .1rem;
  padding: .5rem; border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01));
  border: 1px solid var(--line);
}
.sidenav .vt {
  display: flex; align-items: center; gap: .55rem; width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left;
  color: var(--muted); font: 500 .875rem/1.2 var(--sans);
  padding: .52rem .6rem; border-radius: 9px;
  transition: background .15s ease, color .15s ease;
}
.sidenav .vt:hover { background: rgba(255,255,255,.05); color: var(--text); }
.sidenav .vt.on { background: rgba(94, 106, 210,.16); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.sidenav .vt.muted { color: var(--dim); }
.sidenav .vt i {
  margin-left: auto; font-style: normal; font: 500 .7rem/1 var(--mono);
  background: rgba(255,255,255,.07); color: var(--muted); border-radius: 99px; padding: .16rem .38rem;
}
.sidenav .vt.on i { background: rgba(94, 106, 210,.3); color: var(--accent-hi); }
.sidenav .vt.muted i { display: none; }

/* the four controls that change what you are looking at stay out; the rest
   sit behind a disclosure, closed by default */
.controls.advanced { display: block; padding: 0; background: none; border: 0; }
.controls.advanced > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: .4rem;
  color: var(--dim); font: 500 .72rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  padding: .35rem .1rem; margin-bottom: .5rem;
}
.controls.advanced > summary::-webkit-details-marker { display: none; }
.controls.advanced > summary::before { content: "+"; font-size: .9rem; }
.controls.advanced[open] > summary::before { content: "–"; }
.controls.advanced > summary:hover { color: var(--text); }
.advrow {
  display: flex; gap: .35rem; flex-wrap: wrap; align-items: center;
  padding: .5rem .6rem; margin-bottom: .9rem;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.008));
  border: 1px solid var(--line); border-radius: 12px;
  font-size: .82rem; color: var(--muted);
}
.advrow label { display: inline-flex; align-items: center; gap: .45rem; padding: .2rem .5rem; border-radius: 8px; }

@media (max-width: 900px) {
  .appshell { grid-template-columns: 1fr; }
  .sidenav { position: static; flex-direction: row; overflow-x: auto; }
  .sidenav .vt { width: auto; white-space: nowrap; }
  .sidenav .vt.on { box-shadow: inset 0 -2px 0 var(--accent); }
}

/* ---------------------------------------------------------- focus mode ----
   The brief used to float over the right third of the canvas, so clicking a
   topic often hid the topic. In focus mode the workspace fills the viewport
   and the panel becomes a real third column, moved there in the DOM by
   setFocus(). Widths are shares of the viewport, so a 13" laptop and a 27"
   desktop get the same proportions. */
.workspace.focus {
  position: fixed; inset: 0; z-index: 60; margin: 0; padding: 1vw;
  gap: 1vw; background: var(--bg);
  grid-template-columns: clamp(190px, 14%, 320px) minmax(0, 1fr) clamp(300px, 24%, 520px);
}
.workspace.focus #cy,
.workspace.focus #cy3d { height: calc(100vh - 2vw); min-height: 0; width: 100%; }
.workspace.focus > #detail {
  position: static; width: auto; max-width: none; transform: none;
  box-shadow: none; align-self: stretch; height: calc(100vh - 2vw);
}

/* Phones keep the normal stacked view: there is no room to show a graph and a
   brief side by side, and zooming a canvas fights the page scroll. */
@media (max-width: 720px) {
  .workspace.focus {
    position: static; padding: 0; gap: .75rem; grid-template-columns: 268px 1fr;
  }
  .workspace.focus #cy, .workspace.focus #cy3d { width: 100%; height: 68vh; }
}

/* ------------------------------------------------------- app shell width --
   main{max-width:1180px} is right for the marketing sections and wrong for the
   app: on a 1920 screen the graph was getting about a third of the monitor and
   208px of the rest went to a vertical tab card. */
.appshell {
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
  gap: .9rem;
}

/* The break-out that lets the app use more than the marketing container.
   Centred with negative margins rather than `left: 50%` + translateX(-50%).
   The transform version broke focus mode: setFocus() clears transforms on
   every ancestor (a transformed ancestor becomes the containing block for the
   position:fixed overlay), which left `left: 50%` unopposed and threw the
   whole shell 676px right, putting 652px of horizontal scroll on the page.
   No transform here means nothing for setFocus to clear.

   Must come after the width:100% rule above, or that one wins on width. */
@media (min-width: 1240px) {
  .appshell {
    --shell: min(1460px, calc(100vw - 3rem));
    width: var(--shell);
    margin-inline: calc((100% - var(--shell)) / 2);
  }
}

.sidenav {
  position: static; flex-direction: row; align-items: center; gap: .15rem;
  padding: 0 0 .1rem; background: none; border: 0;
  border-bottom: 1px solid var(--line); border-radius: 0;
  overflow-x: auto; scrollbar-width: none;
}
.sidenav::-webkit-scrollbar { display: none; }
.sidenav .vt {
  width: auto; white-space: nowrap; padding: .55rem .85rem;
  border-radius: 9px 9px 0 0; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
}
.sidenav .vt.on {
  background: none; color: var(--text);
  box-shadow: none; border-bottom-color: var(--accent);
}
.sidenav .vt i { margin-left: .45rem; }

/* Actions left, status right. */
.toolbar { gap: .35rem; margin-bottom: .7rem; }
.toolbar .tag { margin-left: auto; }
.toolbar .vs { margin-left: .4rem; }

.caption { font-size: .82rem; margin: .1rem 0 .7rem; max-width: 100ch; opacity: .85; }

#cy, #cy3d { height: min(78vh, 900px); }

@media (max-width: 900px) {
  #cy, #cy3d { height: 68vh; }
}
