:root {
  font: 16px/1.5 system-ui, sans-serif;
  color: #141322;
  background: #f4f4f1;
  --surface: #fff;
  --line: #dfdce7;
  --text-muted: #625e70;
  --accent: #6a40e0;
  --accent-hover: #532dbb;
  --accent-soft: #efe9fc;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent-hover); text-underline-offset: .2em; }
a:hover { color: #382180; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner, main {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.topbar-inner, .account, .page-heading, .member-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.topbar-inner {
  justify-content: space-between;
  min-height: 4.25rem;
  padding-block: .75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: inherit;
  font-size: 1.15rem;
  font-weight: 750;
  text-decoration: none;
}

.brand span {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: white;
  background: var(--accent);
  border-radius: .55rem;
}

main { padding-block: 2rem 4rem; }
.page-heading { justify-content: space-between; margin-block-end: 1.25rem; }
.page-heading h1 { margin: 0; }
h1, h2, p { margin-block-start: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.7rem, 5vw, 2.45rem); line-height: 1.2; margin-block-end: 1.25rem; }
h2 { font-size: 1.15rem; line-height: 1.35; margin-block-end: 1rem; }
p:last-child { margin-block-end: 0; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  align-items: start;
  gap: 1rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: clamp(1rem, 3vw, 1.5rem);
  border-radius: .9rem;
}

.login { max-width: 25rem; margin-inline: auto; margin-block-start: clamp(0rem, 5vh, 3rem); }
.back { display: inline-block; margin-block-end: 1rem; }
.stack { display: grid; gap: .85rem; }
.field, label { display: grid; gap: .3rem; }
label { font-weight: 600; }
input, select, button { font: inherit; }
input, select {
  max-width: 100%;
  min-width: 0;
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid #b2adbf;
  border-radius: .5rem;
  background: white;
  color: inherit;
}

button, .quiet {
  display: inline-block;
  justify-self: start;
  padding: .48rem .85rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  background: var(--accent);
  color: white;
  text-decoration: none;
  cursor: pointer;
}

button:hover { background: var(--accent-hover); }
.quiet { color: #342752; background: var(--surface); border-color: var(--line); }
.quiet:hover { color: #342752; background: var(--accent-soft); }
.danger { color: #aa2636; }
.danger:hover { color: #8d1b29; background: #fff0f2; }
:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 3px; }

.rows { margin: 0; padding: 0; list-style: none; }
.rows li { padding-block: .8rem; border-block-start: 1px solid var(--line); }
.rows li:last-child { padding-block-end: 0; }
.member-name { flex: 1 1 8rem; min-width: 0; overflow-wrap: anywhere; }
.project-link { font-weight: 600; overflow-wrap: anywhere; }
.count, .lead {
  display: inline-block;
  padding: .14rem .5rem;
  border-radius: .4rem;
  color: #48268f;
  background: var(--accent-soft);
  font-size: .85rem;
}
.count { margin-inline-start: .2rem; }
.muted { color: var(--text-muted); font-size: .92rem; }
.notice, .error { padding: .65rem .85rem; border-radius: .5rem; }
.notice { color: #432783; background: var(--accent-soft); }
.error { color: #8d1b29; background: #fff0f2; }

@media (max-width: 44rem) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

textarea {
  width: 100%;
  min-width: 0;
  padding: .55rem .65rem;
  border: 1px solid #b2adbf;
  border-radius: .5rem;
  background: white;
  color: inherit;
  font: inherit;
  resize: vertical;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
}

.map-graph { padding: .85rem; }
.map-graph-heading { margin-block-end: .85rem; }
.map-graph-heading h2 { margin: 0; }
.map-tools, .map-zoom, .map-legend, .card-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
}

.map-tools { justify-content: space-between; margin-block-end: .65rem; }
.map-tools[hidden] { display: none; }
.map-jump { flex: 1 1 10rem; min-width: 0; }
.map-zoom { font-size: .9rem; }
.map-zoom button { padding: .32rem .62rem; }
.map-zoom output { min-width: 3rem; text-align: center; }

.map-viewport {
  position: relative;
  min-height: 7rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: #f9f8fc radial-gradient(#d9d3e6 1px, transparent 1px) 0 0 / 18px 18px;
}

.map-viewport canvas { display: none; }
.map-viewport.interactive {
  height: clamp(20rem, 55vh, 36rem);
  overflow: clip;
  touch-action: none;
  cursor: grab;
}

.map-viewport.dragging { cursor: grabbing; user-select: none; }
.map-viewport.interactive canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-plane { display: flex; flex-wrap: wrap; gap: .5rem; padding: .5rem; }
.interactive .map-plane {
  position: absolute;
  inset: 0 auto auto 0;
  padding: 0;
  transform-origin: 0 0;
}

.map-node {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .18rem;
  width: min(212px, 100%);
  padding: .6rem .75rem;
  border: 1px solid #c0b4d7;
  border-radius: .65rem;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  line-height: 1.2;
}

.interactive .map-node { position: absolute; width: 212px; height: 110px; }
.map-node strong { overflow-wrap: anywhere; }
.interactive .map-node strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.map-node span { color: var(--text-muted); font-size: .78rem; }
.map-root { background: var(--accent-soft); }
.map-node:hover, .map-selected, .map-node[aria-current] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.map-legend { justify-content: space-between; margin-block-start: .65rem; font-size: .78rem; }
.map-source-legend::before {
  display: inline-block;
  width: 1rem;
  margin-inline-end: .3rem;
  border-block-start: 2px dashed #817692;
  vertical-align: middle;
  content: "";
}

.map-facts { margin: 0; }
.map-facts dt { font-weight: 650; }
.map-facts dd, .map-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.map-facts dd { margin: 0 0 .75rem; }
.map-layout summary { cursor: pointer; color: var(--accent-hover); }
.map-layout details > form, #unformulated ul + form { margin-block-start: .85rem; }
.card-tags { margin-block-end: .75rem; }
.card-form { max-width: 44rem; }
.card-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.card-form fieldset { min-width: 0; margin: 0; border: 1px solid var(--line); border-radius: .5rem; }
.card-form legend { font-weight: 650; }
.card-participants label { display: flex; align-items: baseline; padding-block: .2rem; font-weight: 400; }
.card-participants input { width: auto; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 58rem) {
  .map-layout { grid-template-columns: minmax(0, 1fr); }
}
