/* ---- toolbar: search + rank + toggles ---- */
.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.controls #search {
  flex: 1;
  min-width: 200px;
}
.err {
  color: #ff6b6b;
  min-height: 18px;
  font-size: 13px;
  margin: 0 0 8px;
}

/* ---- stats strip: one row of numbers, gold hairline on top (numbers stay in the body face) ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.stats:empty { display: none }
.stat {
  background: linear-gradient(180deg, rgba(192, 148, 58, 0.07), var(--surface) 60%);
  border: 1px solid var(--border);
  border-top-color: rgba(192, 148, 58, 0.45);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
}
.stat .n {
  color: var(--white);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat.txt .n {
  font-size: 17px;
  line-height: 1.55;
}
.stat .l {
  color: var(--text-dim-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 4px;
}

/* ---- rank sections ---- */
.rank {
  margin-bottom: 24px;
}
.rhead {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 21px;
  color: var(--heading);
  margin-bottom: 10px;
  cursor: pointer;
  user-select: none;
}
.rhead::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-warm);
}
.rhead:hover {
  color: var(--accent-hi);
}
.rhead .c {
  font-family: var(--body);
  color: var(--text-faint);
  font-weight: 700;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 1px 8px;
}
.rhead .caret {
  display: inline-block;
  width: 14px;
  font-family: var(--body);
  font-size: 11px;
  color: var(--text-dim-2);
}
.rhead.low {
  color: var(--text-dim-2);
}

/* ---- member rows ---- */
.members {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px;
}
.m {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  min-height: 36px;
}
.m:hover {
  border-color: var(--line-warm);
  background: var(--surface-2);
}
/* spec icon before the name - click to pick/change */
.spic {
  cursor: pointer;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}
.spici {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  display: block;
}
.spic-none {
  color: var(--text-faint);
  font-size: 15px;
  line-height: 1;
}
.spic:hover .spic-none {
  color: var(--accent);
}
.mn {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lv {
  color: var(--text-faint);
  font-size: 11px;
}
.altof {
  color: var(--text-dim-2);
  font-size: 11px;
  font-style: italic;
}
.armory {
  flex: 0 0 auto;
  margin-left: auto;
  text-decoration: none;
  font-size: 13px;
  opacity: 0.4;
}
.armory:hover {
  opacity: 1;
}

/* ---- floating spec picker ---- */
.specmenu {
  position: absolute;
  z-index: 50;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  min-width: 150px;
}
.specopt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: 0;
  height: auto;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  justify-content: flex-start;
}
.specopt img {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  flex: 0 0 18px;
  object-fit: contain;
}
.specopt:hover {
  background: rgba(255, 255, 255, 0.07);
}
.specopt.on {
  color: var(--accent);
}
.specopt.clear {
  color: var(--text-dim-2);
  border-top: 1px solid var(--border);
  margin-top: 2px;
  padding-top: 6px;
  padding-left: 34px; /* align "clear" with the icon-prefixed options above */
}

/* ---- import modal ---- */
#modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow: auto;
  z-index: 100;
}
#modal .box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
#modal .mhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
#modal .mhead h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 24px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--heading);
}
#modal .box > .sub {
  margin: 0 0 12px;
  line-height: 1.5;
}
#modal textarea {
  width: 100%;
  height: 200px;
  padding: 10px;
  font-family: Consolas, monospace;
  font-size: 12px;
  resize: vertical;
}

/* ---- import diff ---- */
.diff {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  max-height: 260px;
  overflow: auto;
}
.diff .grp + .grp {
  margin-top: 10px;
}
.diff .grp b {
  font-size: 12px;
}
.diff .grp .list {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 2px;
}
.diff .none {
  color: var(--text-faint);
}

/* secondary modal buttons (close / cancel) */
button.alt {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
button.alt:hover {
  border-color: var(--accent);
  color: var(--white);
  filter: none;
}
