/* ============================================================================
   Watchlist page (page-watchlist.php) — fb-app stack.
   Uses semantic tokens + shared primitives (.btn, .eyebrow, .skel). No literal
   hex outside tokens. Header/footer are the shared fb-app partials.
   ========================================================================== */

.wl-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--sp-7) var(--gutter-mobile, 24px) var(--sp-8);
}
@media (min-width: 900px) {
  .wl-wrap { padding-left: var(--gutter, 36px); padding-right: var(--gutter, 36px); }
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.wl-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}
.wl-title {
  margin: var(--sp-1) 0 0;
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}
.wl-sub { margin: var(--sp-2) 0 0; font-size: 0.9rem; color: var(--text-2); }
.wl-head__actions { display: flex; align-items: center; gap: var(--sp-3); }

/* ── List + rows ────────────────────────────────────────────────────────── */
.wl-list { display: flex; flex-direction: column; gap: var(--sp-3); }

.wl-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}
.wl-row:hover { border-color: var(--accent-soft, var(--accent)); }
.wl-row.is-selected { border-color: var(--accent); background: var(--surface-2); }
.wl-row.is-removing { opacity: 0.4; transform: scale(0.99); pointer-events: none; }

/* Compare checkbox */
.wl-check { position: relative; display: inline-flex; width: 20px; height: 20px; cursor: pointer; flex: 0 0 auto; }
.wl-check__box { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.wl-check__mark {
  width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid var(--border); background: var(--surface-2);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.wl-check__box:hover + .wl-check__mark { border-color: var(--accent); }
.wl-check__box:checked + .wl-check__mark {
  background: var(--accent); border-color: var(--accent);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a0a0b' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6L9 17l-5-5'/></svg>");
  background-size: 13px; background-repeat: no-repeat; background-position: center;
}
.wl-check__box:focus-visible + .wl-check__mark { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Fund identity */
.wl-row__id { min-width: 0; display: block; text-decoration: none; }
.wl-row__id:hover .wl-name { color: var(--accent); }
.wl-brand { display: block; font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.wl-name {
  display: block; font-size: 0.98rem; font-weight: 600; line-height: 1.25; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  transition: color 0.15s ease;
}
.wl-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.wl-pill {
  display: inline-flex; align-items: center; padding: 2px 9px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.02em;
  border-radius: 999px; background: var(--accent-soft, var(--surface-2)); color: var(--accent-ink, var(--text));
  border: 1px solid transparent; white-space: nowrap;
}
.wl-pill--soft { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }

/* Metrics */
.wl-metrics { display: flex; align-items: center; gap: var(--sp-5); }
.wl-metric { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 48px; }
.wl-metric__v { font-size: 0.95rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.wl-metric__k { font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.wl-pos { color: var(--pos) !important; }
.wl-neg { color: var(--neg) !important; }
.wl-mut { color: var(--text-muted) !important; }

/* Actions */
.wl-actions { display: flex; align-items: center; gap: var(--sp-2); }
.wl-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 1px solid transparent; color: var(--text-muted);
  cursor: pointer; transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.wl-remove:hover { color: var(--neg); background: var(--surface-2); border-color: var(--border); }

/* ── Skeleton ───────────────────────────────────────────────────────────── */
.wl-row--skel { grid-template-columns: 1fr; }
.wl-skel { display: block; width: 100%; height: 40px; border-radius: 8px; }

/* ── Empty / sign-in state ──────────────────────────────────────────────── */
.wl-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--sp-3); padding: var(--sp-8) var(--sp-5);
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
}
.wl-empty__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--surface-2); color: var(--accent); margin-bottom: var(--sp-1);
}
.wl-empty h2 { margin: 0; font-size: 1.2rem; font-weight: 700; color: var(--text); }
.wl-empty p { margin: 0; max-width: 42ch; font-size: 0.92rem; line-height: 1.5; color: var(--text-2); }
.wl-empty .btn { margin-top: var(--sp-3); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .wl-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "check id actions"
      "check metrics metrics";
    gap: var(--sp-2) var(--sp-4);
  }
  .wl-check { grid-area: check; align-self: start; margin-top: 2px; }
  .wl-row__id { grid-area: id; }
  .wl-actions { grid-area: actions; align-self: start; }
  .wl-metrics { grid-area: metrics; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-2); }
  .wl-metric { align-items: flex-start; min-width: 0; }
  .wl-metric__v { font-size: 0.88rem; }
}
