/* Setup column (U2): brand, profile block, priority builder, talent budget; and the talent calculator sheet.
   Composes base.css primitives; tokens only. Gold = selection, the top rank and the budget. Green (q2) = a gear
   effect, as in a WoW tooltip's "Equip:" line. */

/* ---- column ---- */
.su { display: flex; flex-direction: column; }
.su-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  min-height: 56px; padding: var(--s3) var(--s3) var(--s3) var(--s4); border-bottom: var(--hair);
}
.su-brand { font-size: var(--fs-xl); line-height: 1.2; color: var(--text); }
.su-tools { display: flex; gap: var(--s1); }
.su-tools [hidden] { display: none; } /* panels.css gives .pn-btn-badge display: grid, which beats [hidden] */
.su-sec { display: grid; gap: var(--s3); padding: var(--s4); border-bottom: var(--hair); }
.su-sec:last-child { border-bottom: 0; }
.su-sec[hidden] { display: none; }
.su-title { font-size: var(--fs-lg); line-height: 1.25; color: var(--text); }
.su-title label { cursor: text; }
.su-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 28px; }
.su-label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.su-label svg { width: 14px; height: 14px; }
.su-seg { flex-wrap: nowrap; }
.su-seg > button { font-variant-numeric: tabular-nums; }
.su-seg > button:hover { color: var(--text); }
.su-select { height: 34px; }
.su-error { color: var(--bad); font-size: var(--fs-md); }

/* loading */
.su-skel { gap: var(--s2); }
.su-sk-line { display: block; height: 10px; width: 42%; }
.su-sk-field { display: block; height: 34px; }
.su-sk-chips { display: block; height: 28px; width: 72%; }
.su-sk-meter { display: block; height: 6px; }

/* ---- profile block ---- */
.su-summary {
  display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 40px; padding: 5px var(--s2) 5px 5px;
  background: var(--bg); border: var(--hair-strong); border-radius: var(--radius);
  color: var(--text); font-size: var(--fs-md); text-align: left; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease);
}
.su-summary:hover { border-color: var(--muted); }
.su-summary > svg { width: 16px; height: 16px; margin-left: auto; color: var(--muted); flex: none; }
.su-summary-text { display: flex; flex-wrap: wrap; align-items: center; column-gap: 7px; row-gap: 0; line-height: 1.35; }
.su-dot { width: 3px; height: 3px; background: var(--muted); flex: none; }
.su-cls-icon { --q: var(--line-strong); }

.su-form { display: grid; gap: var(--s3); }
.su-field { display: grid; gap: 6px; }
.su-first .su-field[data-missing] > .su-label::after,
.su-first .su-talented[data-missing] > .su-label::after {
  content: ""; width: 4px; height: 4px; background: var(--gold-line);
}
.su-level { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.su-level .su-seg > button { padding: 0 8px; }
.su-level-in { width: 76px; height: 30px; }
.su-done { justify-self: start; }

.su-talented { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.su-talented .su-seg > button { width: 30px; padding: 0; }

.su-profs > summary {
  display: flex; align-items: center; gap: 6px; min-height: 28px; cursor: pointer; list-style: none;
}
.su-profs > summary::-webkit-details-marker { display: none; }
.su-profs > summary > svg { width: 14px; height: 14px; color: var(--muted); transition: transform var(--t-fast) var(--ease); }
.su-profs[open] > summary > svg { transform: rotate(90deg); }
.su-profs > summary:hover .su-label { color: var(--text); }
.su-profs-sum { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); color: var(--text-2); }
.su-profs-body { display: grid; gap: var(--s2); padding-top: var(--s2); }
.su-prof { display: grid; grid-template-columns: minmax(0, 1fr) 64px 30px; gap: var(--s2); align-items: center; }
.su-prof .field { height: 30px; }
.su-rank { padding: 0 var(--s2); text-align: right; }
.su-add { justify-self: start; height: 26px; padding: 0 var(--s2); font-size: var(--fs-sm); }
.su-add svg { width: 14px; height: 14px; }

/* number inputs: no spinners (they crowd the small fields) */
.su input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.su input[type="number"]::-webkit-inner-spin-button,
.su input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ---- priority: the field with its underline layer ---- */
.pr-presets { display: flex; align-items: center; gap: var(--s1); }
.pr-presets .su-select { height: 28px; width: auto; max-width: 150px; font-size: var(--fs-sm); color: var(--text-2); }
.pr-undo { height: 28px; padding: 0 var(--s2); font-size: var(--fs-sm); }
.pr-undo svg { width: 14px; height: 14px; }

.pr-field { position: relative; background: var(--bg); border-radius: var(--radius); }
.pr-input { position: relative; z-index: 1; background: transparent; }
.pr-mirror {
  position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  padding: 0 var(--s3); border: 1px solid transparent;
  font-size: var(--fs-base); line-height: 32px; white-space: pre; color: transparent;
}
.pr-bad { text-decoration: underline wavy var(--bad); text-decoration-skip-ink: none; text-underline-offset: 4px; }
.pr-dup { text-decoration: underline dotted var(--muted); text-underline-offset: 4px; }
.pr-flash { animation: pr-glint 700ms var(--ease) both; }
@keyframes pr-glint {
  from { box-shadow: 0 0 0 1px var(--gold); }
  to { box-shadow: 0 0 0 1px transparent; }
}
@media (prefers-reduced-motion: reduce) { .pr-flash { animation: none; } }

.pr-hints { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); margin-top: calc(-1 * var(--s1)); font-size: var(--fs-sm); }
.pr-hints[hidden] { display: none; }
.pr-hint { display: inline-flex; align-items: center; gap: 6px; }
.pr-hint .pr-bad { color: var(--text); }
.btn.pr-fix { height: 24px; padding: 0 6px; font-size: var(--fs-sm); color: var(--gold); }
.btn.pr-drop { width: 24px; height: 24px; }
.btn.pr-drop svg { width: 12px; height: 12px; }
.pr-err { color: var(--bad); }

/* ---- ranked chips: rank order, ties boxed together, weight inside ---- */
.pr-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 28px; }
.pr-chips.pr-empty {
  align-items: center; justify-content: center; border: 1px dashed var(--line-strong); border-radius: var(--radius);
  color: var(--muted); font-size: var(--fs-sm);
}
.pr-chips.pr-empty::before { content: "No stats ranked"; }
.pr-chips.drop-end { box-shadow: inset 0 -1px 0 var(--gold); }
.pr-solo { display: inline-flex; }
.pr-group { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 2px; border: var(--hair-strong); border-radius: var(--radius); background: var(--bg); }

.chip.pr-chip { position: relative; gap: 7px; padding: 0 8px; cursor: grab; }
.chip.pr-chip.pr-top { border-color: var(--gold-line); color: var(--gold); background: var(--gold-soft); }
.chip.pr-chip:active { cursor: grabbing; }
.pr-key {
  display: inline-flex; align-items: center; height: 100%; padding: 0; background: none; border: 0;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: inherit;
}
.pr-key:focus-visible { outline: none; }
.pr-chip:has(.pr-key:focus-visible) { outline: 1px solid var(--gold); outline-offset: 2px; }
.pr-w { font-size: var(--fs-xs); font-weight: var(--fw-regular); letter-spacing: 0; color: var(--muted); }
.pr-top .pr-w { color: var(--gold); opacity: 0.8; }
.pr-w-in {
  width: 46px; height: 20px; padding: 0 4px; background: var(--bg); border: var(--hair-strong); border-radius: var(--radius);
  color: var(--text); font-size: var(--fs-xs); text-align: right; letter-spacing: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.pr-w-in::-webkit-inner-spin-button, .pr-w-in::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pr-w-in:focus { outline: none; border-color: var(--gold-line); }
.pr-w-in.invalid { border-color: var(--bad); }
.pr-x {
  position: absolute; top: -7px; right: -7px; z-index: 1; display: grid; place-items: center;
  width: 15px; height: 15px; background: var(--panel); border: var(--hair-strong); border-radius: var(--radius);
  color: var(--muted); opacity: 0; transition: opacity var(--t-fast) var(--ease);
}
.pr-x svg { width: 10px; height: 10px; }
.pr-chip:hover .pr-x, .pr-key:focus-visible .pr-x { opacity: 1; }
.pr-key:hover .pr-x { color: var(--bad); border-color: var(--bad); }
.pr-dragging { opacity: 0.4; }
.pr-chip.drop-before::before, .pr-chip.drop-after::after {
  content: ""; position: absolute; top: 2px; bottom: 2px; width: 1px; background: var(--gold);
}
.pr-chip.drop-before::before { left: -4px; }
.pr-chip.drop-after::after { right: -4px; }
.pr-chip.drop-tie { outline: 1px solid var(--gold); outline-offset: 2px; }

/* ---- "Add stat": the one add path (a dragged chip dropped on this row is removed) ---- */
.pr-addrow { display: flex; align-items: center; border-radius: var(--radius); }
.pr-addrow.drop-out { outline: 1px dashed var(--muted); outline-offset: 3px; }
.btn.pr-allbtn { height: 24px; padding: 0 4px 0 6px; gap: 2px; font-size: var(--fs-sm); }
.btn.pr-allbtn svg { width: 14px; height: 14px; }
.btn.pr-allbtn[aria-expanded="true"] { color: var(--text); }

.pr-all { display: grid; gap: var(--s3); padding: var(--s3); background: var(--bg); border: var(--hair); border-radius: var(--radius); max-height: 340px; overflow: auto; }
.pr-all[hidden] { display: none; }
.pr-allgroup { display: grid; gap: 6px; }
.pr-allhead { font-size: var(--fs-xs); color: var(--muted); }
.pr-allhead::first-letter { text-transform: uppercase; }
.pr-allchips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip.pr-pick { height: 24px; padding: 0 7px; font-size: var(--fs-xs); }

.pr-weights .su-seg > button { padding: 0 8px; }

/* ---- talent budget ---- */
.su-budget { font-size: var(--fs-md); color: var(--muted); white-space: nowrap; }
.su-meter.su-dense { gap: 2px; }
.tc-meta .su-meter.su-dense { gap: 1px; }
.su-budget b { color: var(--text); font-weight: var(--fw-medium); }
.su-tal-actions { justify-content: flex-start; flex-wrap: wrap; }
.su-tal-actions .badge svg { width: 11px; height: 11px; margin-right: 3px; }
.su-tal-actions .btn[aria-expanded="true"] { color: var(--gold); border-color: var(--gold-line); }
.su-toggles { display: grid; gap: 6px; }
.su-toggle-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip.su-toggle { height: 24px; padding: 0 8px; font-size: var(--fs-xs); text-transform: none; letter-spacing: 0; }

/* ---- talent calculator sheet ---- */
.tc { display: grid; gap: var(--s4); }
.tc-empty { font-size: var(--fs-md); }
.tc-meta { display: flex; align-items: center; gap: var(--s2); }
.tc-pts { font-size: var(--fs-md); color: var(--muted); white-space: nowrap; }
.tc-pts b { color: var(--text); font-weight: var(--fw-medium); }
.tc-meta .su-meter { width: 140px; }

.tc-tabs { display: flex; width: 100%; }
.tc-tabs > button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 var(--s2); background: transparent; border: 0; border-right: var(--hair);
  color: var(--muted); font-size: var(--fs-sm); cursor: pointer;
}
.tc-tabs > button:last-child { border-right: 0; }
.tc-tabs > button:hover { color: var(--text); }
.tc-tabs > button[aria-selected="true"] { color: var(--gold); background: var(--gold-soft); }
.tc-tabpts { color: var(--muted); }
.tc-tabs > button[aria-selected="true"] .tc-tabpts { color: var(--gold); }

.tc-grid {
  position: relative; display: grid;
  grid-template-columns: repeat(var(--tc-cols, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--tc-tiers, 7), 54px);
  gap: 10px 12px;
}
.tc-link { position: relative; z-index: 0; pointer-events: none; }
.tc-link::before { content: ""; position: absolute; background: var(--line-strong); }
.tc-link.met::before { background: var(--gold-line); }
.tc-v::before { left: 50%; top: 27px; bottom: 27px; width: 1px; }
.tc-h::before { top: 50%; left: 25%; right: 25%; height: 1px; }

.tc-cell {
  position: relative; z-index: 1; display: grid; grid-template-rows: 1fr auto; gap: 2px;
  padding: 5px 7px; text-align: left; background: var(--panel-2); border: var(--hair-strong); border-radius: var(--radius);
  color: var(--text-2); font-size: var(--fs-xs); line-height: 1.25; cursor: pointer; user-select: none;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.tc-cell:hover { border-color: var(--muted); color: var(--text); }
.tc-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tc-rank { justify-self: end; color: var(--muted); }
.tc-cell[data-state="some"] { border-color: var(--gold-line); color: var(--text); }
.tc-cell[data-state="some"] .tc-rank { color: var(--gold); }
.tc-cell[data-state="max"] { border-color: var(--gold); background: var(--gold-soft); color: var(--text); }
.tc-cell[data-state="max"] .tc-rank { color: var(--gold); }
.tc-cell[data-state="locked"] { background: var(--panel); border-color: var(--line); border-style: dashed; color: var(--muted); }
.tc-cell[data-state="locked"]:hover { border-color: var(--line-strong); color: var(--text-2); }
.tc-cell[data-invalid] { border-color: var(--bad); }
.tc-bad { position: absolute; top: 4px; right: 4px; color: var(--bad); line-height: 0; }
.tc-bad svg { width: 12px; height: 12px; }
.tc-gear { position: absolute; left: 7px; bottom: 8px; width: 5px; height: 5px; background: var(--q2); }
.tc-cell[data-state="locked"] .tc-gear { opacity: 0.5; }
.tc-cell[data-refused] { animation: tc-refuse 600ms var(--ease) both; }
@keyframes tc-refuse {
  from { box-shadow: 0 0 0 1px var(--bad); }
  to { box-shadow: 0 0 0 1px transparent; }
}
@media (prefers-reduced-motion: reduce) { .tc-cell[data-refused] { animation: none; box-shadow: 0 0 0 1px var(--bad); } }

.tc-detail { min-height: 92px; }
.tc-detail .tt-name { font-size: var(--fs-base); color: var(--text); }
.tc-next { margin-top: var(--s1); }

.tc-impact { display: grid; gap: var(--s2); }
.tc-impact h3 { font-size: var(--fs-md); color: var(--text); }
.tc-impact-list { display: grid; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.tc-imp { display: grid; grid-template-columns: 16px auto minmax(0, 1fr); column-gap: var(--s2); row-gap: 1px; font-size: var(--fs-sm); align-items: baseline; }
.tc-imp-mark { grid-row: span 2; align-self: start; padding-top: 2px; color: var(--dim); line-height: 0; }
.tc-imp-mark svg { width: 14px; height: 14px; }
.tc-imp-name { color: var(--text); white-space: nowrap; }
.tc-imp-rank { color: var(--muted); }
.tc-imp-what { color: var(--text-2); }
.tc-imp-note { grid-column: 2 / -1; font-size: var(--fs-xs); color: var(--muted); }
.tc-imp[data-status="on"] .tc-imp-mark { color: var(--q2); }
.tc-imp[data-status="on"] .tc-imp-what { color: var(--q2); }
.tc-imp[data-status="off"] .tc-imp-what, .tc-imp[data-status="none"] .tc-imp-what { color: var(--muted); }
.tc-imp-none { font-size: var(--fs-sm); }

.tc-import { display: grid; gap: var(--s2); }
.tc-paste { display: flex; gap: var(--s2); }
.tc-paste-in { flex: 1; }
.tc-paste .btn { height: 34px; }
.tc-msg { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.tc-msg svg { width: 14px; height: 14px; flex: none; }
.tc-msg[data-kind="error"] { color: var(--bad); }
.tc-msg[data-kind="ok"] svg { color: var(--ok); }
.tc-msg[data-kind="warn"] svg { color: var(--warn); }

.tc-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.tc-math { font-size: var(--fs-sm); }
.tc-foot .btn svg { width: 14px; height: 14px; }
